pub struct PropertiesBox { /* private fields */ }
Expand description
Smart pointer to hold an owned Properties
struct.
§Examples
Create a PropertiesBox
struct and access the stored values by key:
use pipewire::{properties::{properties, PropertiesBox}};
let props = properties!{
"Key" => "Value",
"OtherKey" => "OtherValue"
};
assert_eq!(Some("Value"), props.get("Key"));
assert_eq!(Some("OtherValue"), props.get("OtherKey"));
Implementations§
Source§impl PropertiesBox
impl PropertiesBox
Sourcepub unsafe fn from_raw(ptr: NonNull<pw_properties>) -> Self
pub unsafe fn from_raw(ptr: NonNull<pw_properties>) -> Self
Take ownership of an existing raw pw_properties
pointer.
§Safety
- The provided pointer must point to a valid, well-aligned
pw_properties
struct. - After this call, the returned
PropertiesBox
struct will assume ownership of the data pointed to, so that data must not be freed elsewhere.
Sourcepub fn into_raw(self) -> *mut pw_properties
pub fn into_raw(self) -> *mut pw_properties
Give up ownership of the contained properties , returning a pointer to the raw pw_properties
struct.
After this function, the caller is responsible for pw_properties
struct,
and should make sure it is freed when it is no longer needed.
Methods from Deref<Target = Properties>§
pub fn as_raw(&self) -> &pw_properties
Sourcepub fn as_raw_ptr(&self) -> *mut pw_properties
pub fn as_raw_ptr(&self) -> *mut pw_properties
Obtain a pointer to the underlying pw_properties
struct.
The pointer is only valid for the lifetime of the Properties
struct the pointer was obtained from,
and must not be dereferenced after it is dropped.
Ownership of the pw_properties
struct is not transferred to the caller and must not be manually freed.
pub fn dict(&self) -> &DictRef
pub fn to_owned(&self) -> PropertiesBox
pub fn get(&self, key: &str) -> Option<&str>
pub fn insert<K, V>(&mut self, key: K, value: V)
pub fn remove<T>(&mut self, key: T)
pub fn clear(&mut self)
Trait Implementations§
Source§impl AsRef<DictRef> for PropertiesBox
impl AsRef<DictRef> for PropertiesBox
Source§impl AsRef<Properties> for PropertiesBox
impl AsRef<Properties> for PropertiesBox
Source§fn as_ref(&self) -> &Properties
fn as_ref(&self) -> &Properties
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for PropertiesBox
impl Clone for PropertiesBox
Source§impl Debug for PropertiesBox
impl Debug for PropertiesBox
Source§impl Default for PropertiesBox
impl Default for PropertiesBox
Source§impl Deref for PropertiesBox
impl Deref for PropertiesBox
Source§impl DerefMut for PropertiesBox
impl DerefMut for PropertiesBox
Auto Trait Implementations§
impl Freeze for PropertiesBox
impl RefUnwindSafe for PropertiesBox
impl !Send for PropertiesBox
impl !Sync for PropertiesBox
impl Unpin for PropertiesBox
impl UnwindSafe for PropertiesBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more