capsules_extra::net::ipv6

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

Source§

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

Source§

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.