Struct libspa::pod::parser::Parser

source ·
pub struct Parser<'d> { /* private fields */ }
Expand description

Low-level wrapper around spa_pod_parser.

Using this may require using unsafe and/or working with C types, but is still more safe and rusty than the raw functions and types.

Implementations§

source§

impl<'d> Parser<'d>

source

pub fn new(data: &'d [u8]) -> Self

source

pub fn from_pod(pod: &'d Pod) -> Self

source

pub fn as_raw(&self) -> &spa_pod_parser

source

pub fn as_raw_ptr(&self) -> *mut spa_pod_parser

source

pub fn into_raw(self) -> spa_pod_parser

source

pub unsafe fn state(&self) -> spa_pod_parser_state

§Safety

The parser state may only be used as long as all frames that were pushed to the parser at the time of this call are alive and not moved

source

pub unsafe fn reset(&mut self, state: *mut spa_pod_parser_state)

§Safety

TODO: Constraints unknown, use at own risk

source

pub unsafe fn deref(&mut self, offset: u32, size: u32) -> *mut spa_pod

§Safety

TODO: Constraints unknown, use at own risk

source

pub unsafe fn frame(&mut self, frame: *mut spa_pod_frame) -> *mut spa_pod

§Safety

TODO: Constraints unknown, use at own risk

source

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

source

pub fn current(&mut self) -> *mut spa_pod

source

pub unsafe fn advance(&mut self, pod: *const spa_pod)

§Safety

Pod pointed to must we valid, well aligned, and contained in the current frame

TODO: Any other constraints? Use at own risk

source

pub unsafe fn next(&mut self) -> *mut spa_pod

§Safety

TODO: Constraints unknown, use at own risk

source

pub unsafe fn pop(&mut self, frame: &mut spa_pod_frame) -> Result<(), Errno>

§Safety

Only the last added frame may be popped

source

pub fn get_bool(&mut self) -> Result<bool, Errno>

source

pub fn get_id(&mut self) -> Result<Id, Errno>

source

pub fn get_int(&mut self) -> Result<i32, Errno>

source

pub fn get_long(&mut self) -> Result<i64, Errno>

source

pub fn get_float(&mut self) -> Result<c_float, Errno>

source

pub fn get_double(&mut self) -> Result<c_double, Errno>

source

pub fn get_string_raw(&mut self) -> Result<&'d CStr, Errno>

source

pub fn get_bytes(&mut self) -> Result<&'d [u8], Errno>

source

pub fn get_pointer(&mut self) -> Result<(*const c_void, Id), Errno>

source

pub fn get_fd(&mut self) -> Result<i64, Errno>

source

pub fn get_rectangle(&mut self) -> Result<Rectangle, Errno>

source

pub fn get_fraction(&mut self) -> Result<Fraction, Errno>

source

pub fn get_pod(&mut self) -> Result<&'d Pod, Errno>

source

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.

source

pub unsafe fn push_object( &mut self, frame: &mut MaybeUninit<spa_pod_frame>, _type: u32 ) -> Result<Id, 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.

Auto Trait Implementations§

§

impl<'d> RefUnwindSafe for Parser<'d>

§

impl<'d> !Send for Parser<'d>

§

impl<'d> !Sync for Parser<'d>

§

impl<'d> Unpin for Parser<'d>

§

impl<'d> UnwindSafe for Parser<'d>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.