Struct smoltcp::wire::NdiscOption

source ·
pub struct NdiscOption<T: AsRef<[u8]>> { /* private fields */ }
Expand description

A read/write wrapper around an NDISC Option.

Implementations§

source§

impl<T: AsRef<[u8]>> NdiscOption<T>

Core getter methods relevant to any type of NDISC option.

source

pub const fn new_unchecked(buffer: T) -> NdiscOption<T>

Create a raw octet buffer with an NDISC Option structure.

source

pub fn new_checked(buffer: T) -> Result<NdiscOption<T>>

Shorthand for a combination of new_unchecked and check_len.

source

pub fn check_len(&self) -> Result<()>

Ensure that no accessor method will panic if called. Returns Err(Error) if the buffer is too short.

The result of this check is invalidated by calling set_data_len.

source

pub fn into_inner(self) -> T

Consume the NDISC option, returning the underlying buffer.

source

pub fn option_type(&self) -> Type

Return the option type.

source

pub fn data_len(&self) -> u8

Return the length of the data.

source§

impl<T: AsRef<[u8]>> NdiscOption<T>

Getter methods only relevant for Source/Target Link-layer Address options.

Return the Source/Target Link-layer Address.

source§

impl<T: AsRef<[u8]>> NdiscOption<T>

Getter methods only relevant for the MTU option.

source

pub fn mtu(&self) -> u32

Return the MTU value.

source§

impl<T: AsRef<[u8]>> NdiscOption<T>

Getter methods only relevant for the Prefix Information option.

source

pub fn prefix_len(&self) -> u8

Return the prefix length.

source

pub fn prefix_flags(&self) -> PrefixInfoFlags

Return the prefix information flags.

source

pub fn valid_lifetime(&self) -> Duration

Return the valid lifetime of the prefix.

source

pub fn preferred_lifetime(&self) -> Duration

Return the preferred lifetime of the prefix.

source

pub fn prefix(&self) -> Ipv6Address

Return the prefix.

source§

impl<'a, T: AsRef<[u8]> + ?Sized> NdiscOption<&'a T>

source

pub fn data(&self) -> &'a [u8]

Return the option data.

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>

Core setter methods relevant to any type of NDISC option.

source

pub fn set_option_type(&mut self, value: Type)

Set the option type.

source

pub fn set_data_len(&mut self, value: u8)

Set the option data length.

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>

Setter methods only relevant for Source/Target Link-layer Address options.

Set the Source/Target Link-layer Address.

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>

Setter methods only relevant for the MTU option.

source

pub fn set_mtu(&mut self, value: u32)

Set the MTU value.

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>

Setter methods only relevant for the Prefix Information option.

source

pub fn set_prefix_len(&mut self, value: u8)

Set the prefix length.

source

pub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)

Set the prefix information flags.

source

pub fn set_valid_lifetime(&mut self, time: Duration)

Set the valid lifetime of the prefix.

source

pub fn set_preferred_lifetime(&mut self, time: Duration)

Set the preferred lifetime of the prefix.

source

pub fn clear_prefix_reserved(&mut self)

Clear the reserved bits.

source

pub fn set_prefix(&mut self, addr: Ipv6Address)

Set the prefix.

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>

Setter methods only relevant for the Redirected Header option.

source

pub fn clear_redirected_reserved(&mut self)

Clear the reserved bits.

source§

impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> NdiscOption<&'a mut T>

source

pub fn data_mut(&mut self) -> &mut [u8]

Return a mutable pointer to the option data.

Trait Implementations§

source§

impl<T: Debug + AsRef<[u8]>> Debug for NdiscOption<T>

source§

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

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

impl<'a, T: AsRef<[u8]> + ?Sized> Display for NdiscOption<&'a T>

source§

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

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

impl<T: PartialEq + AsRef<[u8]>> PartialEq<NdiscOption<T>> for NdiscOption<T>

source§

fn eq(&self, other: &NdiscOption<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: AsRef<[u8]>> PrettyPrint for NdiscOption<T>

source§

fn pretty_print(
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter<'_>,
indent: &mut PrettyIndent
) -> Result

Write a concise, formatted representation of a packet contained in the provided buffer, and any nested packets it may contain. Read more
source§

impl<T: Eq + AsRef<[u8]>> Eq for NdiscOption<T>

source§

impl<T: AsRef<[u8]>> StructuralEq for NdiscOption<T>

source§

impl<T: AsRef<[u8]>> StructuralPartialEq for NdiscOption<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for NdiscOption<T>where
T: RefUnwindSafe,

§

impl<T> Send for NdiscOption<T>where
T: Send,

§

impl<T> Sync for NdiscOption<T>where
T: Sync,

§

impl<T> Unpin for NdiscOption<T>where
T: Unpin,

§

impl<T> UnwindSafe for NdiscOption<T>where
T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · 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> ToString for Twhere
T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.