[][src]Struct lv2rs_atom::array::ArrayAtomBody

#[repr(C)]
pub struct ArrayAtomBody<H, T> where
    H: ArrayAtomHeader,
    T: 'static + Sized + Copy
{ pub header: H, pub data: [T], }

Abstract type for dynamically sized atom bodies.

Many dynamically sized atoms bodies have a lot of their behaviour and raw representation in common. Therefore, they are abstracted to this struct that contains a header and an array of sized items.

If you don't want to have a header, you can use () instead.

Not all combinations of header and data items are atom bodies, but many methods rely on the combination being an atom body.

Fields

header: Hdata: [T]

Methods

impl<H, T> ArrayAtomBody<H, T> where
    Self: AtomBody,
    H: ArrayAtomHeader,
    T: 'static + Sized + Copy
[src]

pub unsafe fn __initialize_body<'a, W>(
    writer: &mut W,
    parameter: &H::InitializationParameter,
    urids: &mut CachedMap
) -> Result<(), ()> where
    W: WritingFrame<'a> + WritingFrameExt<'a, Self>, 
[src]

Internal method to initialize the body.

It simply calls the initialization method of the header, the data array will be left empty.

pub fn __create_ref<'a>(raw_data: &'a [u8]) -> Result<&'a Self, ()>[src]

Internal method to create an atom body reference.

pub unsafe fn push<'a, W>(writer: &mut W, value: T) -> Result<(), ()> where
    W: WritingFrame<'a> + WritingFrameExt<'a, Self>, 
[src]

Push another value to the data array.

In case of insufficient memory, an Err is returned.

This method assumes that the atom was already initialized, but since can't be checked, this method is unsafe.

pub unsafe fn append<'a, W>(writer: &mut W, slice: &[T]) -> Result<(), ()> where
    W: WritingFrame<'a> + WritingFrameExt<'a, Self>, 
[src]

Append a T slice to the data.

In case of insufficient memory, an Err is returned.

This method assumes that the atom was already initialized, but since can't be checked, this method is unsafe.

Auto Trait Implementations

impl<H, T> Send for ArrayAtomBody<H, T> where
    H: Send,
    T: Send

impl<H, T> Sync for ArrayAtomBody<H, T> where
    H: Sync,
    T: Sync

Blanket Implementations

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

impl<T> From for 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> Borrow for T where
    T: ?Sized
[src]

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

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

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.