Trait pipewire_wrapper::spa::list::ListElement
source · pub trait ListElement {
// Required methods
fn as_list_ptr(&self) -> *mut spa_list;
fn from_list_ptr(ptr: *mut spa_list) -> *mut Self;
// Provided methods
unsafe fn init_detached(&mut self) { ... }
unsafe fn remove(&mut self) { ... }
}
Expand description
Linked list element. Usually, data structures should have spa_sys::spa_list pointer at the first place. So, the pointer to the list element can be casted to the structure itself. In general, this struct should not be used outside the library.
Example
use spa_sys::spa_list;
struct TestElement {
link: spa_list,
payload: u32,
}
Required Methods§
sourcefn as_list_ptr(&self) -> *mut spa_list
fn as_list_ptr(&self) -> *mut spa_list
Raw pointer to the list element
sourcefn from_list_ptr(ptr: *mut spa_list) -> *mut Self
fn from_list_ptr(ptr: *mut spa_list) -> *mut Self
Cast the list element pointer to Self
Provided Methods§
sourceunsafe fn init_detached(&mut self)
unsafe fn init_detached(&mut self)
Init the list element as detached.
Safety
Self::as_list_ptr must provide valid non-null pointer, that will not be changed in future.
sourceunsafe fn remove(&mut self)
unsafe fn remove(&mut self)
Remove the element from the list
Safety
Self::as_list_ptr must provide valid non-null pointer, that will not be changed in future.