[][src]Struct lv2rs_atom::Atom

#[repr(C)]
pub struct Atom { /* fields omitted */ }

Marker or header of an atom data structure.

This type is used to interpret data coming from the host or other plugins. It is always written in the beginning of a data packet and denotes the size of the packet and it's type.

Methods

impl Atom[src]

pub fn size(&self) -> usize[src]

Return the size of the body.

pub fn mut_size(&mut self) -> &mut i32[src]

Return a mutable reference to the body size.

pub fn atom_type(&self) -> URID[src]

Return the type of the body.

pub fn mut_atom_type(&mut self) -> &mut URID[src]

pub unsafe fn write_empty_header<'a, W: WritingFrame<'a> + WritingFrameExt<'a, A>, A: AtomBody + ?Sized>(
    frame: &mut W,
    atom_type: URID
) -> Result<&'a mut Self, ()>
[src]

Write an empty header to a writing frame.

This function is for internal use and you should not use it externally. Since it does not check what's around it, this function may invalidate the written atom structure. This is also the reason why it's unsafe.

pub fn get_raw_body(&self) -> &[u8][src]

Return a slice of bytes containing the data.

The returned slice will start directly after the atom and will have the size noted in the header.

pub fn get_body<A: AtomBody + ?Sized>(
    &self,
    urids: &mut CachedMap
) -> Result<&A, GetBodyError>
[src]

Try the return a reference to the body.

This function fails if a) the type URID in the atom does not match with A's URID or b) the internal casting function tells that the data is malformed.

Auto Trait Implementations

impl Send for Atom

impl Sync for Atom

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]