mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
feat(dictionary): make methods accessible from an Owned dictionary
This commit is contained in:
@@ -25,7 +25,7 @@ impl<'a> Ref<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Ref<'a> {
|
||||
pub fn set(&mut self, key: &str, value: &str) {
|
||||
pub fn set(&mut self, key: &str, value: &str) -> &mut Self {
|
||||
unsafe {
|
||||
let key = CString::new(key).unwrap();
|
||||
let value = CString::new(value).unwrap();
|
||||
@@ -38,6 +38,8 @@ impl<'a> Ref<'a> {
|
||||
self.ptr = ptr;
|
||||
self.imm = immutable::Ref::wrap(ptr);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ impl Owned {
|
||||
result
|
||||
}
|
||||
|
||||
pub fn as_ptr(&self) -> *const AVDictionary {
|
||||
pub unsafe fn as_ptr(&self) -> *const AVDictionary {
|
||||
self.ptr
|
||||
}
|
||||
|
||||
pub fn as_mut_ptr(&mut self) -> *mut AVDictionary {
|
||||
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVDictionary {
|
||||
self.ptr
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,15 @@ impl Owned {
|
||||
pub fn as_mut(&self) -> mutable::Ref {
|
||||
unsafe { mutable::Ref::wrap(self.ptr) }
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> Iter<'_> {
|
||||
unsafe { Iter::new(self.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn set(&mut self, key: &str, value: &str) -> &mut Self {
|
||||
self.as_mut().set(key, value);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromIterator<(&'a str, &'a str)> for Owned {
|
||||
|
||||
Reference in New Issue
Block a user