pub struct DxMachineBuilder<'a> { /* private fields */ }Expand description
Builder for in-place DX-Machine serialization using RKYV
This builder writes directly to a pre-allocated buffer without any intermediate allocations or copying. Serialization time is effectively zero since it’s just memory writes.
Implementations§
Source§impl<'a> DxMachineBuilder<'a>
impl<'a> DxMachineBuilder<'a>
Sourcepub fn new(
buffer: &'a mut Vec<u8>,
fixed_size: usize,
slot_count: usize,
) -> Self
pub fn new( buffer: &'a mut Vec<u8>, fixed_size: usize, slot_count: usize, ) -> Self
Create a new builder with buffer
Initializes the header and reserves space for fixed fields + slots.
The fixed_size is the size of all primitive fields.
The slot_count is the number of variable-length fields.
Sourcepub fn write_fixed<T: Copy>(&mut self, offset: usize, value: T)
pub fn write_fixed<T: Copy>(&mut self, offset: usize, value: T)
Write fixed field at offset (direct memory write)
Sourcepub fn write_bool(&mut self, offset: usize, value: bool)
pub fn write_bool(&mut self, offset: usize, value: bool)
Write bool at offset
Sourcepub fn write_string(&mut self, slot_offset: usize, value: &str)
pub fn write_string(&mut self, slot_offset: usize, value: &str)
Write string to slot (auto inline/heap optimization)
Sourcepub fn write_bytes(&mut self, slot_offset: usize, bytes: &[u8])
pub fn write_bytes(&mut self, slot_offset: usize, bytes: &[u8])
Write bytes to slot (auto inline/heap optimization)
Sourcepub fn write_array<T: Copy>(&mut self, slot_offset: usize, values: &[T])
pub fn write_array<T: Copy>(&mut self, slot_offset: usize, values: &[T])
Write array to slot (similar to bytes)
Sourcepub fn heap_position(&self) -> usize
pub fn heap_position(&self) -> usize
Get current heap cursor position
Auto Trait Implementations§
impl<'a> !UnwindSafe for DxMachineBuilder<'a>
impl<'a> Freeze for DxMachineBuilder<'a>
impl<'a> RefUnwindSafe for DxMachineBuilder<'a>
impl<'a> Send for DxMachineBuilder<'a>
impl<'a> Sync for DxMachineBuilder<'a>
impl<'a> Unpin for DxMachineBuilder<'a>
impl<'a> UnsafeUnpin for DxMachineBuilder<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.