pub struct Builder<'d> { /* private fields */ }
Implementations§
source§impl<'d> Builder<'d>
impl<'d> Builder<'d>
pub fn new(data: &'d mut Vec<u8>) -> Self
pub fn as_raw(&self) -> &spa_pod_builder
pub fn as_raw_ptr(&self) -> *mut spa_pod_builder
sourcepub unsafe fn state(&self) -> spa_pod_builder_state
pub unsafe fn state(&self) -> spa_pod_builder_state
§Safety
The builder state may only be used as long as all frames that were pushed to the builder at the time of this call are alive and not moved
sourcepub unsafe fn reset(&mut self, state: *mut spa_pod_builder_state)
pub unsafe fn reset(&mut self, state: *mut spa_pod_builder_state)
§Safety
TODO: Constraints unknown, use at own risk
sourcepub unsafe fn deref(&mut self, offset: u32) -> *mut spa_pod
pub unsafe fn deref(&mut self, offset: u32) -> *mut spa_pod
§Safety
TODO: Constraints unknown, use at own risk
sourcepub unsafe fn frame(&mut self, frame: *mut spa_pod_frame) -> *mut spa_pod
pub unsafe fn frame(&mut self, frame: *mut spa_pod_frame) -> *mut spa_pod
§Safety
TODO: Constraints unknown, use at own risk
sourcepub unsafe fn push(
&mut self,
frame: *mut spa_pod_frame,
pod: *const spa_pod,
offset: u32
)
pub unsafe fn push( &mut self, frame: *mut spa_pod_frame, pod: *const spa_pod, offset: u32 )
§Safety
TODO: Constraints unknown, use at own risk
pub fn raw_padded(&mut self, data: &[u8]) -> Result<(), Errno>
sourcepub unsafe fn pop(&mut self, frame: &mut spa_pod_frame)
pub unsafe fn pop(&mut self, frame: &mut spa_pod_frame)
§Safety
Only the last added frame may be popped
pub fn add_none(&mut self) -> Result<(), Errno>
pub fn add_bool(&mut self, val: bool) -> Result<(), Errno>
pub fn add_id(&mut self, val: Id) -> Result<(), Errno>
pub fn add_int(&mut self, val: i32) -> Result<(), Errno>
pub fn add_long(&mut self, val: i64) -> Result<(), Errno>
pub fn add_float(&mut self, val: f32) -> Result<(), Errno>
pub fn add_double(&mut self, val: f64) -> Result<(), Errno>
sourcepub fn add_string(&mut self, string: &str) -> Result<(), Errno>
pub fn add_string(&mut self, string: &str) -> Result<(), Errno>
§Panics
If string
contains an interior null byte
pub fn add_bytes(&mut self, bytes: &[u8]) -> Result<(), Errno>
sourcepub unsafe fn add_pointer(
&mut self,
type_: Id,
val: *const c_void
) -> Result<(), Errno>
pub unsafe fn add_pointer( &mut self, type_: Id, val: *const c_void ) -> Result<(), Errno>
§Safety
The pointer must be pointing to valid, well-aligned data which has the type as specified by type_
.
pub fn add_fd(&mut self, val: RawFd) -> Result<(), Errno>
pub fn add_rectangle(&mut self, val: Rectangle) -> Result<(), Errno>
pub fn add_fraction(&mut self, val: Fraction) -> Result<(), Errno>
sourcepub unsafe fn push_array(
&mut self,
frame: &mut MaybeUninit<spa_pod_frame>
) -> Result<(), Errno>
pub unsafe fn push_array( &mut self, frame: &mut MaybeUninit<spa_pod_frame> ) -> Result<(), Errno>
§Safety
The provided frame must not be moved or destroyed before it is popped again.
The frame may only be assumed as initialized if this method returns Ok
.
sourcepub unsafe fn add_array(
&mut self,
child_size: u32,
child_type: u32,
n_elems: u32,
elems: *const c_void
) -> Result<(), Errno>
pub unsafe fn add_array( &mut self, child_size: u32, child_type: u32, n_elems: u32, elems: *const c_void ) -> Result<(), Errno>
§Safety
elems
must point to a valid array containing at least n_elems
with each child having exactly the size as specified by child_size
and the type child_type
.
sourcepub unsafe fn push_choice(
&mut self,
frame: &mut MaybeUninit<spa_pod_frame>,
type_: u32,
flags: u32
) -> Result<(), Errno>
pub unsafe fn push_choice( &mut self, frame: &mut MaybeUninit<spa_pod_frame>, type_: u32, flags: u32 ) -> Result<(), Errno>
§Safety
The provided frame must not be moved or destroyed before it is popped again.
The frame may only be assumed as initialized if this method returns Ok
.
sourcepub unsafe fn push_struct(
&mut self,
frame: &mut MaybeUninit<spa_pod_frame>
) -> Result<(), Errno>
pub unsafe fn push_struct( &mut self, frame: &mut MaybeUninit<spa_pod_frame> ) -> Result<(), Errno>
§Safety
The provided frame must not be moved or destroyed before it is popped again.
The frame may only be assumed as initialized if this method returns Ok
.
sourcepub unsafe fn push_object(
&mut self,
frame: &mut MaybeUninit<spa_pod_frame>,
type_: u32,
id: u32
) -> Result<(), Errno>
pub unsafe fn push_object( &mut self, frame: &mut MaybeUninit<spa_pod_frame>, type_: u32, id: u32 ) -> Result<(), Errno>
§Safety
The provided frame must not be moved or destroyed before it is popped again.
The frame may only be assumed as initialized if this method returns Ok
.
pub fn add_prop(&mut self, key: u32, flags: u32) -> Result<(), Errno>
sourcepub unsafe fn push_sequence(
&mut self,
frame: &mut MaybeUninit<spa_pod_frame>,
unit: u32
) -> Result<(), Errno>
pub unsafe fn push_sequence( &mut self, frame: &mut MaybeUninit<spa_pod_frame>, unit: u32 ) -> Result<(), Errno>
§Safety
The provided frame must not be moved or destroyed before it is popped again.
The frame may only be assumed as initialized if this method returns Ok
.