#[repr(C)]pub struct ArrayAtomBody<H, T>{
pub header: H,
pub data: [T],
}Expand description
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: H§data: [T]Implementations§
Source§impl<H, T> ArrayAtomBody<H, T>
impl<H, T> ArrayAtomBody<H, T>
Sourcepub unsafe fn __initialize_body<'a, W>(
writer: &mut W,
parameter: &H::InitializationParameter,
urids: &mut CachedMap,
) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
pub unsafe fn __initialize_body<'a, W>(
writer: &mut W,
parameter: &H::InitializationParameter,
urids: &mut CachedMap,
) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
Internal method to initialize the body.
It simply calls the initialization method of the header, the data array will be left empty.
Sourcepub fn __create_ref<'a>(raw_data: &'a [u8]) -> Result<&'a Self, ()>
pub fn __create_ref<'a>(raw_data: &'a [u8]) -> Result<&'a Self, ()>
Internal method to create an atom body reference.
Sourcepub unsafe fn push<'a, W>(writer: &mut W, value: T) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
pub unsafe fn push<'a, W>(writer: &mut W, value: T) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
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.
Sourcepub unsafe fn append<'a, W>(writer: &mut W, slice: &[T]) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
pub unsafe fn append<'a, W>(writer: &mut W, slice: &[T]) -> Result<(), ()>where
W: WritingFrame<'a> + WritingFrameExt<'a, Self>,
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.
Source§impl ArrayAtomBody<LiteralHeader, u8>
impl ArrayAtomBody<LiteralHeader, u8>
Source§impl ArrayAtomBody<ObjectHeader, u8>
impl ArrayAtomBody<ObjectHeader, u8>
Sourcepub fn iter<'a>(
&'a self,
) -> impl Iterator<Item = (&'a PropertyHeader, &'a Atom)>
pub fn iter<'a>( &'a self, ) -> impl Iterator<Item = (&'a PropertyHeader, &'a Atom)>
Create an iterator over all properties of the object.
This iterator is based on the ChunkIterator.
Source§impl ArrayAtomBody<SequenceHeader, u8>
impl ArrayAtomBody<SequenceHeader, u8>
Source§impl ArrayAtomBody<(), i8>
impl ArrayAtomBody<(), i8>
Sourcepub fn as_cstr(&self) -> Result<&CStr, FromBytesWithNulError>
pub fn as_cstr(&self) -> Result<&CStr, FromBytesWithNulError>
Try to wrap the string into a CStr reference.
This function returns an error if the internal conversion fails.
Source§impl ArrayAtomBody<(), u8>
impl ArrayAtomBody<(), u8>
Sourcepub fn iter(&self) -> impl Iterator<Item = &Atom>
pub fn iter(&self) -> impl Iterator<Item = &Atom>
Create an iterator over all properties of the object.
This iterator is based on the AtomIterator.
Source§impl<T> ArrayAtomBody<VectorHeader, T>
impl<T> ArrayAtomBody<VectorHeader, T>
Sourcepub fn child_body_size(&self) -> usize
pub fn child_body_size(&self) -> usize
Return the size of the child type, according to the vector’s body header.
Sourcepub fn child_body_type(&self) -> URID
pub fn child_body_type(&self) -> URID
Return the type of the child, according to the vector’s body header.