Struct capsules_extra::net::ipv6::IPPayload

source ·
pub struct IPPayload<'a> {
    pub header: TransportHeader,
    pub payload: &'a mut [u8],
}
Expand description

The IPPayload struct contains a TransportHeader and a mutable buffer (the payload).

Fields§

§header: TransportHeader§payload: &'a mut [u8]

Implementations§

source§

impl<'a> IPPayload<'a>

source

pub fn new(header: TransportHeader, payload: &'a mut [u8]) -> IPPayload<'a>

This function constructs a new IPPayload struct

§Arguments

header - A TransportHeader for the IPPayload payload - A reference to a mutable buffer for the raw payload

source

pub fn set_payload( &mut self, transport_header: TransportHeader, payload: &SubSliceMut<'static, u8>, ) -> (u8, u16)

This function sets the payload for the IPPayload, and sets both the TransportHeader and copies the provided payload buffer.

§Arguments

transport_header - The new TransportHeader header for the payload payload - The payload to be copied into the IPPayload

§Return Value

(u8, u16) - Returns a tuple of the ip6_nh type of the transport_header and the total length of the IPPayload (when serialized)

source

pub fn encode(&self, buf: &mut [u8], offset: usize) -> SResult<usize>

This function encodes the IPPayload as a byte array

§Arguments

buf - SubSliceMut to write the serialized IPPayload to offset - Current offset into the buffer

§Return Value

SResult<usize> - The final offset into the buffer buf is returned wrapped in an SResult

Auto Trait Implementations§

§

impl<'a> Freeze for IPPayload<'a>

§

impl<'a> RefUnwindSafe for IPPayload<'a>

§

impl<'a> Send for IPPayload<'a>

§

impl<'a> Sync for IPPayload<'a>

§

impl<'a> Unpin for IPPayload<'a>

§

impl<'a> !UnwindSafe for IPPayload<'a>

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, 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.