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
Attempts to write the given bytes to the serializer.
Trait Implementations
Allocates scratch space of the requested size. Read more
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.
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
metadata_resolver: <T as ArchiveUnsized>::MetadataResolver
) -> Result<usize, Self::Error> where
T: ArchiveUnsized + ?Sized,
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
metadata_resolver: <T as ArchiveUnsized>::MetadataResolver
) -> Result<usize, Self::Error> where
T: ArchiveUnsized + ?Sized,
Resolves the given reference with its resolver and writes the archived reference. Read more
fn serialize_unsized_value<T>(
&mut self,
value: &T
) -> Result<usize, Self::Error> where
T: SerializeUnsized<Self> + ?Sized,
fn serialize_unsized_value<T>(
&mut self,
value: &T
) -> Result<usize, Self::Error> where
T: SerializeUnsized<Self> + ?Sized,
Archives a reference to the given object and returns the position it was archived at.