Trait rkyv_dyn::DynSerializer[][src]

pub trait DynSerializer {
    fn pos_dyn(&self) -> usize;
fn write_dyn(&mut self, bytes: &[u8]) -> Result<(), DynError>;
unsafe fn push_scratch_dyn(
        &mut self,
        layout: Layout
    ) -> Result<NonNull<[u8]>, DynError>;
unsafe fn pop_scratch_dyn(
        &mut self,
        ptr: NonNull<u8>,
        layout: Layout
    ) -> Result<(), DynError>; }
Expand description

An object-safe version of Serializer.

Instead of an associated error type, DynSerializer returns the DynError type. If you have a serializer that already implements Serializer, then it will automatically implement DynSerializer.

Required methods

Returns the current position of the serializer.

Attempts to write the given bytes to the serializer.

Allocates scratch space of the requested size.

Safety

layout must have non-zero size.

Deallocates previously allocated scratch space.

Safety

  • ptr must be the scratch memory last allocated with push_scratch.
  • layout must be the same layout that was used to allocate that block of memory.

Trait Implementations

The error produced by any failing methods.

Allocates scratch space of the requested size. Read more

Deallocates previously allocated scratch space. Read more

Returns the current position of the serializer.

Attempts to write the given bytes to the serializer.

Advances the given number of bytes as padding.

Aligns the position of the serializer to the given alignment.

Aligns the position of the serializer to be suitable to write the given type.

Resolves the given value with its resolver and writes the archived type. Read more

Archives the given object and returns the position it was archived at.

Resolves the given reference with its resolver and writes the archived reference. Read more

Archives a reference to the given object and returns the position it was archived at.

Implementations on Foreign Types

Implementors