pub struct NestedWithInnerIpPacket<Inner, Outer>(/* private fields */);
Expand description

A nested serializer whose inner serializer implements IpPacket.

[packet::Nested] is often used to represent an outer IP packet serializer and an inner payload contained by the IP packet. However, in some cases, a type that implements IpPacket may itself be wrapped in an outer serializer, such as (for example) a [packet::LimitedSizePacketBuilder] for enforcing an MTU. In that scenario, the Nested serializer can be wrapped in this type to indicate that the IpPacket implementation should be delegated to the inner serializer.

Implementations§

source§

impl<Inner, Outer> NestedWithInnerIpPacket<Inner, Outer>

source

pub fn new(nested: Nested<Inner, Outer>) -> Self

Creates a new NestedWithInnerIpPacket wrapping the provided nested serializer.

source

pub fn into_inner(self) -> Inner

Calls [Nested::into_inner] on the contained nested serializer.

Trait Implementations§

source§

impl<I: IpExt, Inner: IpPacket<I>, Outer> IpPacket<I> for NestedWithInnerIpPacket<Inner, Outer>

§

type TransportPacket<'a> = <Inner as IpPacket<I>>::TransportPacket<'a> where Inner: 'a, Outer: 'a

The type that provides access to transport-layer header inspection, if a transport header is contained in the body of the IP packet.
source§

fn src_addr(&self) -> I::Addr

The source IP address of the packet.
source§

fn dst_addr(&self) -> I::Addr

The destination IP address of the packet.
source§

fn protocol(&self) -> I::Proto

The IP protocol of the packet.
source§

fn transport_packet(&self) -> Self::TransportPacket<'_>

Returns a type that provides access to the transport-layer packet contained in the body of the IP packet, if one exists. Read more
source§

impl<Inner, Outer> Serializer for NestedWithInnerIpPacket<Inner, Outer>
where Nested<Inner, Outer>: Serializer,

§

type Buffer = <Nested<Inner, Outer> as Serializer>::Buffer

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

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

Serializes this Serializer, producing a buffer. Read more
§

fn serialize_outer<B, P>( self, provider: P ) -> Result<B, (SerializeError<<P as BufferProvider<Self::Buffer, B>>::Error>, Self)>
where B: GrowBufferMut, P: BufferProvider<Self::Buffer, B>,

Serializes this Serializer as the outermost packet. Read more
§

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

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

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

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

Auto Trait Implementations§

§

impl<Inner, Outer> Freeze for NestedWithInnerIpPacket<Inner, Outer>
where Inner: Freeze, Outer: Freeze,

§

impl<Inner, Outer> RefUnwindSafe for NestedWithInnerIpPacket<Inner, Outer>
where Inner: RefUnwindSafe, Outer: RefUnwindSafe,

§

impl<Inner, Outer> Send for NestedWithInnerIpPacket<Inner, Outer>
where Inner: Send, Outer: Send,

§

impl<Inner, Outer> Sync for NestedWithInnerIpPacket<Inner, Outer>
where Inner: Sync, Outer: Sync,

§

impl<Inner, Outer> Unpin for NestedWithInnerIpPacket<Inner, Outer>
where Inner: Unpin, Outer: Unpin,

§

impl<Inner, Outer> UnwindSafe for NestedWithInnerIpPacket<Inner, Outer>
where Inner: UnwindSafe, Outer: 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<CC, BC, Meta> RecvFrameContext<BC, Meta> for CC
where Meta: ReceivableFrameMeta<CC, BC>,

source§

fn receive_frame<B>(&mut self, bindings_ctx: &mut BC, metadata: Meta, frame: B)
where B: BufferMut + Debug,

Receive a frame. Read more
source§

impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CC
where Meta: SendableFrameMeta<CC, BC>,

source§

fn send_frame<S>( &mut self, bindings_ctx: &mut BC, metadata: Meta, frame: S ) -> Result<(), S>
where S: Serializer, <S as Serializer>::Buffer: BufferMut,

Send a frame. Read more
source§

impl<Meta, BC> SendableFrameMeta<FakeFrameCtx<Meta>, BC> for Meta

source§

fn send_meta<S>( self, core_ctx: &mut FakeFrameCtx<Meta>, _bindings_ctx: &mut BC, frame: S ) -> Result<(), S>
where S: Serializer, <S as Serializer>::Buffer: BufferMut,

Sends this frame metadata to the provided contexts.
source§

impl<Id, CC, BC> TimerHandler<BC, Id> for CC
where Id: HandleableTimer<CC, BC>,

source§

fn handle_timer(&mut self, bindings_ctx: &mut BC, id: Id)

Handle a timer firing.
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more