[][src]Trait lv2::prelude::MutSpace

pub trait MutSpace<'a> {
    fn allocate(
        &mut self,
        size: usize,
        apply_padding: bool
    ) -> Option<(usize, &'a mut [u8])>; fn write_raw(
        &mut self,
        data: &[u8],
        apply_padding: bool
    ) -> Option<&'a mut [u8]> { ... } }

A smart pointer that writes atom data to an internal slice.

The methods provided by this trait are fairly minimalistic. More convenient writing methods are implemented for dyn MutSpace.

Required methods

fn allocate(
    &mut self,
    size: usize,
    apply_padding: bool
) -> Option<(usize, &'a mut [u8])>

Try to allocate memory on the internal data slice.

If apply_padding is true, the method will assure that the allocated memory is 64-bit-aligned. The first return value is the number of padding bytes that has been used and the second return value is a mutable slice referencing the allocated data.

After the memory has been allocated, the MutSpace can not allocate it again. The next allocated slice is directly behind it.

Loading content...

Provided methods

fn write_raw(
    &mut self,
    data: &[u8],
    apply_padding: bool
) -> Option<&'a mut [u8]>

Try to write data to the internal data slice.

The method allocates a slice with the allocate method and copies the data to the slice.

Loading content...

Implementations

impl<'a, 'b> dyn MutSpace<'a> + 'b[src]

pub fn write<T>(
    &mut self,
    instance: &T,
    apply_padding: bool
) -> Option<&'a mut T> where
    T: Unpin + Copy + Send + Sync + 'static, 
[src]

Write a sized object to the space.

If apply_padding is true, the method will assure that the written instance is 64-bit-aligned.

pub fn init<'c, A>(
    &'c mut self,
    urid: URID<A>,
    parameter: <A as Atom<'a, 'c>>::WriteParameter
) -> Option<<A as Atom<'a, 'c>>::WriteHandle> where
    A: Atom<'a, 'c>, 
[src]

Initialize a new atom in the space.

Implementations on Foreign Types

impl<'a> MutSpace<'a> for SpaceHead<'a>[src]

impl<'a> MutSpace<'a> for RootMutSpace<'a>[src]

Loading content...

Implementors

impl<'a, 'b> MutSpace<'a> for FramedMutSpace<'a, 'b>[src]

Loading content...