pub struct Serializer<W, A, S> {
pub writer: W,
pub allocator: A,
pub sharing: S,
}Expand description
A serializer built from composeable pieces.
Fields§
§writer: WThe writer of the serializer.
allocator: AThe allocator of the serializer.
sharing: SThe pointer sharing of the serializer.
Implementations§
Source§impl<W, A, S> Serializer<W, A, S>
impl<W, A, S> Serializer<W, A, S>
Sourcepub fn new(writer: W, allocator: A, sharing: S) -> Self
pub fn new(writer: W, allocator: A, sharing: S) -> Self
Creates a new serializer from a writer, allocator, and pointer sharing.
Sourcepub fn into_raw_parts(self) -> (W, A, S)
pub fn into_raw_parts(self) -> (W, A, S)
Consumes the serializer and returns the components.
Sourcepub fn into_writer(self) -> W
pub fn into_writer(self) -> W
Consumes the serializer and returns the writer.
The allocator and pointer sharing are discarded.
Trait Implementations§
Source§impl<W, A: Allocator<E>, S, E> Allocator<E> for Serializer<W, A, S>
impl<W, A: Allocator<E>, S, E> Allocator<E> for Serializer<W, A, S>
Source§impl<W: Default, A: Default, S: Default> Default for Serializer<W, A, S>
impl<W: Default, A: Default, S: Default> Default for Serializer<W, A, S>
Source§fn default() -> Serializer<W, A, S>
fn default() -> Serializer<W, A, S>
Returns the “default value” for a type. Read more
Source§impl<W: Positional, A, S> Positional for Serializer<W, A, S>
impl<W: Positional, A, S> Positional for Serializer<W, A, S>
Source§impl<W, A, S: Sharing<E>, E> Sharing<E> for Serializer<W, A, S>
impl<W, A, S: Sharing<E>, E> Sharing<E> for Serializer<W, A, S>
Source§fn start_sharing(&mut self, address: usize) -> SharingState
fn start_sharing(&mut self, address: usize) -> SharingState
Starts sharing the value associated with the given address.
Auto Trait Implementations§
impl<W, A, S> Freeze for Serializer<W, A, S>
impl<W, A, S> RefUnwindSafe for Serializer<W, A, S>
impl<W, A, S> Send for Serializer<W, A, S>
impl<W, A, S> Sync for Serializer<W, A, S>
impl<W, A, S> Unpin for Serializer<W, A, S>
impl<W, A, S> UnwindSafe for Serializer<W, A, S>
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<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>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
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>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.Source§impl<S, E> SharingExt<E> for S
impl<S, E> SharingExt<E> for S
Serializes the given shared value and returns its position. If the value
has already been serialized then it returns the position of the
previously added value. Read more
Source§impl<T, E> WriterExt<E> for T
impl<T, E> WriterExt<E> for T
Source§fn pad(&mut self, padding: usize) -> Result<(), E>
fn pad(&mut self, padding: usize) -> Result<(), E>
Advances the given number of bytes as padding.
Source§fn align(&mut self, align: usize) -> Result<usize, E>
fn align(&mut self, align: usize) -> Result<usize, E>
Aligns the position of the serializer to the given alignment.
Source§fn align_for<T>(&mut self) -> Result<usize, E>
fn align_for<T>(&mut self) -> Result<usize, E>
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, E>
unsafe fn resolve_aligned<T: Archive + ?Sized>( &mut self, value: &T, resolver: T::Resolver, ) -> Result<usize, E>
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,
) -> Result<usize, E>
unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>( &mut self, value: &T, to: usize, ) -> Result<usize, E>
Resolves the given reference with its resolver and writes the archived
reference. Read more