Struct packet::serialize::Nested

source ·
pub struct Nested<I, O> { /* private fields */ }
Expand description

One object encapsulated in another one.

Nesteds are constructed using the [NestedPacketBuilder::encapsulate] and Serializer::encapsulate methods.

When I: NestedPacketBuilder and O: NestedPacketBuilder, Nested<I, O> implements [NestedPacketBuilder]. When I: Serializer and O: NestedPacketBuilder, Nested<I, O> implements Serializer.

Implementations§

source§

impl<I, O> Nested<I, O>

source

pub fn into_inner(self) -> I

Consumes this Nested and returns the inner object, discarding the outer one.

source

pub fn into_outer(self) -> O

Consumes this Nested and returns the outer object, discarding the inner one.

source

pub fn inner(&self) -> &I

source

pub fn outer(&self) -> &O

Trait Implementations§

source§

impl<I: Clone, O: Clone> Clone for Nested<I, O>

source§

fn clone(&self) -> Nested<I, O>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug, O: Debug> Debug for Nested<I, O>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I: Serializer, O: PacketBuilder> Serializer for Nested<I, O>

§

type Buffer = <I as Serializer>::Buffer

The type of buffers returned from serialization methods on this trait.
source§

fn serialize<B: GrowBufferMut, P: BufferProvider<I::Buffer, B>>( self, outer: PacketConstraints, provider: P ) -> Result<B, (SerializeError<P::Error>, Self)>

Serializes this Serializer, producing a buffer. Read more
source§

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

fn encapsulate<B>(self, outer: B) -> Nested<Self, B>

Encapsulates this Serializer in another packet, producing a new Serializer. Read more
source§

fn with_size_limit(self, limit: usize) -> Nested<Self, LimitedSizePacketBuilder>

Creates a new Serializer which will enforce a size limit. Read more
source§

impl<I: Copy, O: Copy> Copy for Nested<I, O>

Auto Trait Implementations§

§

impl<I, O> Freeze for Nested<I, O>
where I: Freeze, O: Freeze,

§

impl<I, O> RefUnwindSafe for Nested<I, O>

§

impl<I, O> Send for Nested<I, O>
where I: Send, O: Send,

§

impl<I, O> Sync for Nested<I, O>
where I: Sync, O: Sync,

§

impl<I, O> Unpin for Nested<I, O>
where I: Unpin, O: Unpin,

§

impl<I, O> UnwindSafe for Nested<I, O>
where I: UnwindSafe, O: UnwindSafe,

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> 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<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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.