[−][src]Trait lv2::prelude::MutSpace
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])>
&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.
Provided methods
fn write_raw(
&mut self,
data: &[u8],
apply_padding: bool
) -> Option<&'a mut [u8]>
&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.
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]
&mut self,
instance: &T,
apply_padding: bool
) -> Option<&'a mut T> where
T: Unpin + Copy + Send + Sync + 'static,
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]
&'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>,
Initialize a new atom in the space.