pub struct PropertiesBox { /* private fields */ }Expand description
Smart pointer providing unique ownership of a PipeWire properties object.
For an explanation of these, see Smart pointers to PipeWire objects.
§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_propertiesstruct. - After this call, the returned
PropertiesBoxstruct 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.