Struct pipewire::properties::Properties
source · pub struct Properties { /* private fields */ }
Expand description
A collection of key/value pairs.
§Examples
Create a Properties
struct and access the stored values by key:
use pipewire::{properties::{properties, Properties}};
let props = properties!{
"Key" => "Value",
"OtherKey" => "OtherValue"
};
assert_eq!(Some("Value"), props.get("Key"));
assert_eq!(Some("OtherValue"), props.get("OtherKey"));
Implementations§
source§impl Properties
impl Properties
sourcepub unsafe fn from_ptr(ptr: NonNull<pw_properties>) -> Self
pub unsafe fn from_ptr(ptr: NonNull<pw_properties>) -> Self
Create a Properties
struct from an existing raw pw_properties
pointer.
§Safety
- The provided pointer must point to a valid, well-aligned
pw_properties
struct. - After this call, the generated
Properties
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
Consume the Properties
struct, 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 = PropertiesRef>§
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 PropertiesRef
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) -> Properties
pub fn get(&self, key: &str) -> Option<&str>
pub fn get_cstr(&self, key: &CStr) -> 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 Properties
impl AsRef<DictRef> for Properties
source§impl AsRef<PropertiesRef> for Properties
impl AsRef<PropertiesRef> for Properties
source§fn as_ref(&self) -> &PropertiesRef
fn as_ref(&self) -> &PropertiesRef
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for Properties
impl Clone for Properties
source§impl Debug for Properties
impl Debug for Properties
source§impl Default for Properties
impl Default for Properties
source§impl Deref for Properties
impl Deref for Properties
source§impl DerefMut for Properties
impl DerefMut for Properties
source§impl Drop for Properties
impl Drop for Properties
Auto Trait Implementations§
impl RefUnwindSafe for Properties
impl !Send for Properties
impl !Sync for Properties
impl Unpin for Properties
impl UnwindSafe for Properties
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