pub struct Pod(/* private fields */);
Expand description
A transparent wrapper around a spa_sys::spa_pod
.
Implementations§
source§impl Pod
impl Pod
sourcepub unsafe fn from_raw(pod: *const spa_pod) -> &'static Self
pub unsafe fn from_raw(pod: *const spa_pod) -> &'static Self
§Safety
The provided pointer must point to a valid, well-aligned pod.
The pods allocation must fit the entire size of the pod as indicated by the pods header, including header size, body size and any padding.
The provided pod must not be mutated, moved, freed or similar while the borrow returned from this function is in use. This also means that other nonmutable borrows may be created to this pod, but no mutable borrows to this pod may be created until all borrows are dropped.
The returned type has 'static
lifetime.
It is suggested to shorten the lifetime to whatever is applicable afterwards.
sourcepub unsafe fn from_raw_mut(pod: *mut spa_pod) -> &'static mut Self
pub unsafe fn from_raw_mut(pod: *mut spa_pod) -> &'static mut Self
§Safety
The provided pointer must point to a valid, well-aligned pod.
The pods allocation must fit the entire size of the pod as indicated by the pods header, including header size, body size and any padding.
The provided pod must not be mutated, moved, freed or similar while the borrow returned from this function is in use. This also means that no other borrow to this pod may be created until the borrow is dropped.
The returned type has 'static
lifetime.
It is suggested to shorten the lifetime to whatever is applicable afterwards.
pub fn as_raw_ptr(&self) -> *mut spa_pod
sourcepub fn body(&self) -> *mut c_void
pub fn body(&self) -> *mut c_void
Returns a pointer to the pods body.
If the pod has an empty body, this can be outside the pods allocation.
sourcepub fn from_bytes(bytes: &[u8]) -> Option<&Self>
pub fn from_bytes(bytes: &[u8]) -> Option<&Self>
Construct a pod from raw bytes.
The provided slice must be big enough to fit the entire pod including padding.