pub struct InnerSerializer<I, B> { /* private fields */ }
Expand description
A Serializer
constructed from an InnerPacketBuilder
.
An InnerSerializer
wraps an InnerPacketBuilder
and a buffer, and
implements the Serializer
trait. When a serialization is requested, it
either reuses the stored buffer or allocates a new one large enough to hold
itself and all outer PacketBuilder
s.
Implementations§
Trait Implementations§
Source§impl<I: Clone, B: Clone> Clone for InnerSerializer<I, B>
impl<I: Clone, B: Clone> Clone for InnerSerializer<I, B>
Source§fn clone(&self) -> InnerSerializer<I, B>
fn clone(&self) -> InnerSerializer<I, B>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<I: InnerPacketBuilder, B: GrowBuffer + ShrinkBuffer> Serializer for InnerSerializer<I, B>
impl<I: InnerPacketBuilder, B: GrowBuffer + ShrinkBuffer> Serializer for InnerSerializer<I, B>
Source§fn serialize<BB: GrowBufferMut, P: BufferProvider<B, BB>>(
self,
outer: PacketConstraints,
provider: P,
) -> Result<BB, (SerializeError<P::Error>, InnerSerializer<I, B>)>
fn serialize<BB: GrowBufferMut, P: BufferProvider<B, BB>>( self, outer: PacketConstraints, provider: P, ) -> Result<BB, (SerializeError<P::Error>, InnerSerializer<I, B>)>
Serializes this
Serializer
, producing a buffer. Read moreSource§fn serialize_new_buf<BB: ReusableBuffer, A: BufferAlloc<BB>>(
&self,
outer: PacketConstraints,
alloc: A,
) -> Result<BB, SerializeError<A::Error>>
fn serialize_new_buf<BB: ReusableBuffer, A: BufferAlloc<BB>>( &self, outer: PacketConstraints, alloc: A, ) -> Result<BB, SerializeError<A::Error>>
Serializes the data into a new buffer without consuming
self
. Read moreSource§fn serialize_vec(
self,
outer: PacketConstraints,
) -> Result<Either<Self::Buffer, Buf<Vec<u8>>>, (SerializeError<Never>, Self)>where
Self::Buffer: ReusableBuffer,
fn serialize_vec(
self,
outer: PacketConstraints,
) -> Result<Either<Self::Buffer, Buf<Vec<u8>>>, (SerializeError<Never>, Self)>where
Self::Buffer: ReusableBuffer,
Serializes this
Serializer
, allocating a Buf<Vec<u8>>
if the
contained buffer isn’t large enough. Read moreSource§fn serialize_no_alloc(
self,
outer: PacketConstraints,
) -> Result<Self::Buffer, (SerializeError<BufferTooShortError>, Self)>where
Self::Buffer: ReusableBuffer,
fn serialize_no_alloc(
self,
outer: PacketConstraints,
) -> Result<Self::Buffer, (SerializeError<BufferTooShortError>, Self)>where
Self::Buffer: ReusableBuffer,
Serializes this
Serializer
, failing if the existing buffer is not
large enough. Read moreSource§fn serialize_outer<B: GrowBufferMut, P: BufferProvider<Self::Buffer, B>>(
self,
provider: P,
) -> Result<B, (SerializeError<P::Error>, Self)>
fn serialize_outer<B: GrowBufferMut, P: BufferProvider<Self::Buffer, B>>( self, provider: P, ) -> Result<B, (SerializeError<P::Error>, Self)>
Serializes this
Serializer
as the outermost packet. Read moreSource§fn serialize_vec_outer(
self,
) -> Result<Either<Self::Buffer, Buf<Vec<u8>>>, (SerializeError<Never>, Self)>where
Self::Buffer: ReusableBuffer,
fn serialize_vec_outer(
self,
) -> Result<Either<Self::Buffer, Buf<Vec<u8>>>, (SerializeError<Never>, Self)>where
Self::Buffer: ReusableBuffer,
Serializes this
Serializer
as the outermost packet, allocating a
Buf<Vec<u8>>
if the contained buffer isn’t large enough. Read moreSource§fn serialize_no_alloc_outer(
self,
) -> Result<Self::Buffer, (SerializeError<BufferTooShortError>, Self)>where
Self::Buffer: ReusableBuffer,
fn serialize_no_alloc_outer(
self,
) -> Result<Self::Buffer, (SerializeError<BufferTooShortError>, Self)>where
Self::Buffer: ReusableBuffer,
Serializes this
Serializer
as the outermost packet, failing if the
existing buffer is not large enough. Read moreSource§fn encapsulate<B>(self, outer: B) -> Nested<Self, B>
fn encapsulate<B>(self, outer: B) -> Nested<Self, B>
Source§fn with_size_limit(self, limit: usize) -> Nested<Self, LimitedSizePacketBuilder>
fn with_size_limit(self, limit: usize) -> Nested<Self, LimitedSizePacketBuilder>
Creates a new
Serializer
which will enforce a size limit. Read moreimpl<I: Copy, B: Copy> Copy for InnerSerializer<I, B>
impl<I: Eq, B: Eq> Eq for InnerSerializer<I, B>
impl<I, B> StructuralPartialEq for InnerSerializer<I, B>
Auto Trait Implementations§
impl<I, B> Freeze for InnerSerializer<I, B>
impl<I, B> RefUnwindSafe for InnerSerializer<I, B>where
I: RefUnwindSafe,
B: RefUnwindSafe,
impl<I, B> Send for InnerSerializer<I, B>
impl<I, B> Sync for InnerSerializer<I, B>
impl<I, B> Unpin for InnerSerializer<I, B>
impl<I, B> UnwindSafe for InnerSerializer<I, B>where
I: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)