Skip to main content

DxMachineBuilder

Struct DxMachineBuilder 

Source
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>

Source

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.

Source

pub fn write_fixed<T: Copy>(&mut self, offset: usize, value: T)

Write fixed field at offset (direct memory write)

Source

pub fn write_u8(&mut self, offset: usize, value: u8)

Write u8 at offset

Source

pub fn write_u16(&mut self, offset: usize, value: u16)

Write u16 at offset (little-endian)

Source

pub fn write_u32(&mut self, offset: usize, value: u32)

Write u32 at offset (little-endian)

Source

pub fn write_u64(&mut self, offset: usize, value: u64)

Write u64 at offset (little-endian)

Source

pub fn write_i8(&mut self, offset: usize, value: i8)

Write i8 at offset

Source

pub fn write_i16(&mut self, offset: usize, value: i16)

Write i16 at offset (little-endian)

Source

pub fn write_i32(&mut self, offset: usize, value: i32)

Write i32 at offset (little-endian)

Source

pub fn write_i64(&mut self, offset: usize, value: i64)

Write i64 at offset (little-endian)

Source

pub fn write_f32(&mut self, offset: usize, value: f32)

Write f32 at offset (little-endian)

Source

pub fn write_f64(&mut self, offset: usize, value: f64)

Write f64 at offset (little-endian)

Source

pub fn write_bool(&mut self, offset: usize, value: bool)

Write bool at offset

Source

pub fn write_string(&mut self, slot_offset: usize, value: &str)

Write string to slot (auto inline/heap optimization)

Source

pub fn write_bytes(&mut self, slot_offset: usize, bytes: &[u8])

Write bytes to slot (auto inline/heap optimization)

Source

pub fn write_array<T: Copy>(&mut self, slot_offset: usize, values: &[T])

Write array to slot (similar to bytes)

Source

pub fn finish(self) -> usize

Finalize and return the serialized length

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

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
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

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>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.