Struct libspa::pod::Pod

source ·
pub struct Pod(/* private fields */);
Expand description

A transparent wrapper around a spa_sys::spa_pod.

Implementations§

source§

impl Pod

source

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.

source

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.

source

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

source

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.

source

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.

source

pub fn as_bytes(&self) -> &[u8]

source

pub fn type_(&self) -> SpaTypes

source

pub fn size(&self) -> u32

source

pub fn is_none(&self) -> bool

source

pub fn is_bool(&self) -> bool

source

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

source

pub fn is_id(&self) -> bool

source

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

source

pub fn is_int(&self) -> bool

source

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

source

pub fn is_long(&self) -> bool

source

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

source

pub fn is_float(&self) -> bool

source

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

source

pub fn is_double(&self) -> bool

source

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

source

pub fn is_string(&self) -> bool

source

pub fn is_bytes(&self) -> bool

source

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

source

pub fn is_pointer(&self) -> bool

source

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

source

pub fn is_fd(&self) -> bool

source

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

source

pub fn is_rectangle(&self) -> bool

source

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

source

pub fn is_fraction(&self) -> bool

source

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

source

pub fn is_bitmap(&self) -> bool

source

pub fn is_array(&self) -> bool

source

pub fn is_choice(&self) -> bool

source

pub fn is_struct(&self) -> bool

source

pub fn as_struct(&self) -> Result<&PodStruct, Errno>

source

pub fn is_object(&self) -> bool

source

pub fn as_object(&self) -> Result<&PodObject, Errno>

source

pub fn is_sequence(&self) -> bool

Trait Implementations§

source§

impl AsRef<Pod> for PodObject

source§

fn as_ref(&self) -> &Pod

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Pod> for PodStruct

source§

fn as_ref(&self) -> &Pod

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'p> From<&'p PodObject> for &'p Pod

source§

fn from(value: &'p PodObject) -> Self

Converts to this type from the input type.
source§

impl<'p> From<&'p PodStruct> for &'p Pod

source§

fn from(value: &'p PodStruct) -> Self

Converts to this type from the input type.
source§

impl<'p> TryFrom<&'p Pod> for &'p PodObject

§

type Error = Errno

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

fn try_from(value: &'p Pod) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'p> TryFrom<&'p Pod> for &'p PodStruct

§

type Error = Errno

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

fn try_from(value: &'p Pod) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for Pod

§

impl Send for Pod

§

impl Sync for Pod

§

impl Unpin for Pod

§

impl UnwindSafe for Pod

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.