Struct rkyv::ser::serializers::CompositeSerializer
source · pub struct CompositeSerializer<S = Infallible, C = Infallible, H = Infallible> { /* private fields */ }
Expand description
A serializer built from composeable pieces.
Implementations§
source§impl<S, C, H> CompositeSerializer<S, C, H>
impl<S, C, H> CompositeSerializer<S, C, H>
sourcepub fn new(serializer: S, scratch: C, shared: H) -> Self
pub fn new(serializer: S, scratch: C, shared: H) -> Self
Creates a new composite serializer from serializer, scratch, and shared components.
sourcepub fn into_components(self) -> (S, C, H)
pub fn into_components(self) -> (S, C, H)
Consumes the composite serializer and returns the components.
sourcepub fn into_serializer(self) -> S
pub fn into_serializer(self) -> S
Consumes the composite serializer and returns the serializer.
The scratch space and shared component are discarded.
Trait Implementations§
source§impl<S: Fallible, C: ScratchSpace, H: Fallible> ScratchSpace for CompositeSerializer<S, C, H>
impl<S: Fallible, C: ScratchSpace, H: Fallible> ScratchSpace for CompositeSerializer<S, C, H>
source§impl<S: Serializer, C: Fallible, H: Fallible> Serializer for CompositeSerializer<S, C, H>
impl<S: Serializer, C: Fallible, H: Fallible> Serializer for CompositeSerializer<S, C, H>
source§fn write(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
Attempts to write the given bytes to the serializer.
source§fn pad(&mut self, padding: usize) -> Result<(), Self::Error>
fn pad(&mut self, padding: usize) -> Result<(), Self::Error>
Advances the given number of bytes as padding.
source§fn align(&mut self, align: usize) -> Result<usize, Self::Error>
fn align(&mut self, align: usize) -> Result<usize, Self::Error>
Aligns the position of the serializer to the given alignment.
source§fn align_for<T>(&mut self) -> Result<usize, Self::Error>
fn align_for<T>(&mut self) -> Result<usize, Self::Error>
Aligns the position of the serializer to be suitable to write the given type.
source§unsafe fn resolve_aligned<T: Archive + ?Sized>(
&mut self,
value: &T,
resolver: T::Resolver
) -> Result<usize, Self::Error>
unsafe fn resolve_aligned<T: Archive + ?Sized>( &mut self, value: &T, resolver: T::Resolver ) -> Result<usize, Self::Error>
Resolves the given value with its resolver and writes the archived type. Read more
source§unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>(
&mut self,
value: &T,
to: usize,
metadata_resolver: T::MetadataResolver
) -> Result<usize, Self::Error>
unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>( &mut self, value: &T, to: usize, metadata_resolver: T::MetadataResolver ) -> Result<usize, Self::Error>
Resolves the given reference with its resolver and writes the archived reference. Read more
source§fn serialize_value<T: Serialize<Self>>(
&mut self,
value: &T
) -> Result<usize, Self::Error>
fn serialize_value<T: Serialize<Self>>( &mut self, value: &T ) -> Result<usize, Self::Error>
Archives the given object and returns the position it was archived at.
source§fn serialize_unsized_value<T: SerializeUnsized<Self> + ?Sized>(
&mut self,
value: &T
) -> Result<usize, Self::Error>
fn serialize_unsized_value<T: SerializeUnsized<Self> + ?Sized>( &mut self, value: &T ) -> Result<usize, Self::Error>
Archives a reference to the given object and returns the position it was archived at.
Auto Trait Implementations§
impl<S, C, H> RefUnwindSafe for CompositeSerializer<S, C, H>where C: RefUnwindSafe, H: RefUnwindSafe, S: RefUnwindSafe,
impl<S, C, H> Send for CompositeSerializer<S, C, H>where C: Send, H: Send, S: Send,
impl<S, C, H> Sync for CompositeSerializer<S, C, H>where C: Sync, H: Sync, S: Sync,
impl<S, C, H> Unpin for CompositeSerializer<S, C, H>where C: Unpin, H: Unpin, S: Unpin,
impl<S, C, H> UnwindSafe for CompositeSerializer<S, C, H>where C: UnwindSafe, H: UnwindSafe, S: UnwindSafe,
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§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.