pub struct Serializer<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> { /* private fields */ }

Implementations§

source§

impl<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Serializer<P, ALIGNMENT>

source

pub fn into_buffer(self) -> UniqueAlignedBuffer<ALIGNMENT>

source

pub fn serialize<T: Serialize<Strategy<Self, BoxedError>>>( &mut self, value: &T ) -> Result<(), BoxedError>

Trait Implementations§

source§

impl<E: Error, P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Allocator<E> for Serializer<P, ALIGNMENT>

source§

unsafe fn push_alloc(&mut self, layout: Layout) -> Result<NonNull<[u8]>, E>

Allocates scratch space of the requested size. Read more
source§

unsafe fn pop_alloc( &mut self, ptr: NonNull<u8>, layout: Layout ) -> Result<(), E>

Deallocates previously allocated scratch space. Read more
source§

impl<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Drop for Serializer<P, ALIGNMENT>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> From<Serializer<P, ALIGNMENT>> for SharedAlignedBuffer<ALIGNMENT>

source§

fn from(serializer: Serializer<P, ALIGNMENT>) -> Self

Converts to this type from the input type.
source§

impl<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> From<Serializer<P, ALIGNMENT>> for UniqueAlignedBuffer<ALIGNMENT>

source§

fn from(serializer: Serializer<P, ALIGNMENT>) -> Self

Converts to this type from the input type.
source§

impl<P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Positional for Serializer<P, ALIGNMENT>

source§

fn pos(&self) -> usize

Returns the current position of the writer.
source§

impl<E: Error, P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Sharing<E> for Serializer<P, ALIGNMENT>

source§

fn get_shared_ptr(&self, address: usize) -> Option<usize>

Gets the position of a serialized shared pointer by address. Read more
source§

fn add_shared_ptr(&mut self, address: usize, pos: usize) -> Result<(), E>

Adds the serialized position of a shared pointer.
source§

impl<E: Error, P: BufferRetentionPolicy<ALIGNMENT>, const ALIGNMENT: usize> Writer<E> for Serializer<P, ALIGNMENT>

source§

fn write(&mut self, bytes: &[u8]) -> Result<(), E>

Attempts to write the given bytes to the serializer.

Auto Trait Implementations§

§

impl<P, const ALIGNMENT: usize> RefUnwindSafe for Serializer<P, ALIGNMENT>
where P: RefUnwindSafe,

§

impl<P, const ALIGNMENT: usize> Send for Serializer<P, ALIGNMENT>
where P: Sync,

§

impl<P, const ALIGNMENT: usize> Sync for Serializer<P, ALIGNMENT>
where P: Sync,

§

impl<P, const ALIGNMENT: usize> Unpin for Serializer<P, ALIGNMENT>

§

impl<P, const ALIGNMENT: usize> UnwindSafe for Serializer<P, ALIGNMENT>
where P: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<S, E> SharingExt<E> for S
where S: Sharing<E> + ?Sized,

source§

fn get_shared<T>(&self, value: &T) -> Option<usize>
where T: ?Sized,

Gets the position of a previously-added shared value. Read more
source§

fn add_shared<T>(&mut self, value: &T, pos: usize) -> Result<(), E>
where T: ?Sized,

Adds the position of a shared value to the registry.
source§

fn serialize_shared<T>(&mut self, value: &T) -> Result<usize, Self::Error>
where T: SerializeUnsized<Self> + ?Sized, Self: Fallible<Error = E>,

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.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, E> WriterExt<E> for T
where T: Writer<E> + ?Sized,

source§

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>

Aligns the position of the serializer to the given alignment.
source§

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>( &mut self, value: &T, resolver: <T as Archive>::Resolver ) -> Result<usize, E>
where T: Archive + ?Sized,

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

unsafe fn resolve_unsized_aligned<T>( &mut self, value: &T, to: usize ) -> Result<usize, E>
where T: ArchiveUnsized + ?Sized,

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