pub struct RawSequence { /* private fields */ }Expand description
A sequence that stores heterogeneous values with proper alignment.
The RawSequence provides a memory-efficient way to store heterogeneous values
while maintaining proper alignment requirements for each type. It uses an
internal buffer that aligns values according to their type’s requirements,
up to a maximum alignment of 4096 bytes.
Implementations§
Source§impl RawSequence
impl RawSequence
Sourcepub fn new() -> RawSequence
pub fn new() -> RawSequence
Creates a new empty RawSequence.
The sequence is initialized with a 4096-byte aligned buffer.
Sourcepub fn push<T>(&mut self, value: T)
pub fn push<T>(&mut self, value: T)
Pushes a value onto the sequence.
The value is stored at an address that satisfies its alignment requirements. Automatically grows the internal buffer if needed.
§Panics
Panics if the type’s alignment requirement exceeds 4096 bytes.
Sourcepub unsafe fn drop_in_place<T>(&mut self, p: usize) -> usize
pub unsafe fn drop_in_place<T>(&mut self, p: usize) -> usize
Drops a value in-place at the specified position.
§Safety
- The position must point to a valid value of type T
- The caller must ensure that the value is actually of type T
Returns the position immediately after the dropped value.
Sourcepub unsafe fn next<T>(&self, p: usize) -> (&T, usize)
pub unsafe fn next<T>(&self, p: usize) -> (&T, usize)
Retrieves a reference to the next value at the specified position.
§Safety
- The position must point to a valid value of type T
- The caller must ensure that the value is actually of type T
Returns a tuple containing:
- A reference to the value
- The position immediately after the value