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.
Gets the position of a previously-added shared pointer. Read more
Adds the position of a shared pointer to the registry.
Gets the position of a previously-added shared value. Read more
Adds the position of a shared value to the registry.
Archives the given shared value and returns its position. If the value has already been
added then it returns the position of the previously added value.
Auto Trait Implementations§
impl<S, C, H> Freeze for CompositeSerializer<S, C, H>
impl<S, C, H> RefUnwindSafe for CompositeSerializer<S, C, H>
impl<S, C, H> Send for CompositeSerializer<S, C, H>
impl<S, C, H> Sync for CompositeSerializer<S, C, H>
impl<S, C, H> Unpin for CompositeSerializer<S, C, H>
impl<S, C, H> UnwindSafe for CompositeSerializer<S, C, H>
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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>
Gets the layout of the type.