pub struct Dictionary { /* private fields */ }
Expand description
A dictionary of key-value pairs.
Implementations§
Source§impl Dictionary
impl Dictionary
Sourcepub const unsafe fn from_ptr_ref(ptr: *mut AVDictionary) -> Self
pub const unsafe fn from_ptr_ref(ptr: *mut AVDictionary) -> Self
Wrap a pointer to a AVDictionary
in a Dictionary
.
Without taking ownership of the dictionary.
§Safety
ptr
must be a valid pointer.
The caller must also ensure that the dictionary is not freed while this
object is alive, and that we don’t use the pointer as mutable
Sourcepub const unsafe fn from_ptr_owned(ptr: *mut AVDictionary) -> Self
pub const unsafe fn from_ptr_owned(ptr: *mut AVDictionary) -> Self
Wrap a pointer to a AVDictionary
in a Dictionary
.
Takes ownership of the dictionary.
Meaning it will be freed when the Dictionary
is dropped.
§Safety
ptr
must be a valid pointer.
Sourcepub fn set<'a>(
&mut self,
key: impl CStringLike<'a>,
value: impl CStringLike<'a>,
) -> Result<(), FfmpegError>
pub fn set<'a>( &mut self, key: impl CStringLike<'a>, value: impl CStringLike<'a>, ) -> Result<(), FfmpegError>
Sets a key-value pair in the dictionary. Key and value must not be empty.
Sourcepub fn get<'a>(&self, key: impl CStringLike<'a>) -> Option<&CStr>
pub fn get<'a>(&self, key: impl CStringLike<'a>) -> Option<&CStr>
Returns the value associated with the given key.
If the key is not found, the Option::None
will be returned.
Sourcepub const fn iter(&self) -> DictionaryIterator<'_> ⓘ
pub const fn iter(&self) -> DictionaryIterator<'_> ⓘ
Returns an iterator over the dictionary.
Sourcepub const fn as_ptr(&self) -> *const AVDictionary
pub const fn as_ptr(&self) -> *const AVDictionary
Returns the pointer to the dictionary.
Sourcepub const fn as_mut_ptr_ref(&mut self) -> &mut *mut AVDictionary
pub const fn as_mut_ptr_ref(&mut self) -> &mut *mut AVDictionary
Returns a mutable reference to the pointer to the dictionary.
Sourcepub fn leak(self) -> *mut AVDictionary
pub fn leak(self) -> *mut AVDictionary
Returns the pointer to the dictionary.
Sourcepub fn extend<'a, K, V>(
&mut self,
iter: impl IntoIterator<Item = (K, V)>,
) -> Result<(), FfmpegError>where
K: CStringLike<'a>,
V: CStringLike<'a>,
pub fn extend<'a, K, V>(
&mut self,
iter: impl IntoIterator<Item = (K, V)>,
) -> Result<(), FfmpegError>where
K: CStringLike<'a>,
V: CStringLike<'a>,
Extends a dictionary with an iterator of key-value pairs.
Sourcepub fn try_from_iter<'a, K, V>(
iter: impl IntoIterator<Item = (K, V)>,
) -> Result<Self, FfmpegError>where
K: CStringLike<'a>,
V: CStringLike<'a>,
pub fn try_from_iter<'a, K, V>(
iter: impl IntoIterator<Item = (K, V)>,
) -> Result<Self, FfmpegError>where
K: CStringLike<'a>,
V: CStringLike<'a>,
Creates a new dictionary from an iterator of key-value pairs.
Trait Implementations§
Source§impl Clone for Dictionary
impl Clone for Dictionary
Source§impl Debug for Dictionary
impl Debug for Dictionary
Source§impl Default for Dictionary
impl Default for Dictionary
Source§impl<'a> IntoIterator for &'a Dictionary
impl<'a> IntoIterator for &'a Dictionary
impl Send for Dictionary
Safety: Dictionary
is safe to send between threads.