Struct smoltcp::wire::NdiscOption
source · [−]pub struct NdiscOption<T: AsRef<[u8]>> { /* private fields */ }Expand description
A read/write wrapper around an NDISC Option.
Implementations
sourceimpl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Core getter methods relevant to any type of NDISC option.
sourcepub fn new_unchecked(buffer: T) -> NdiscOption<T>
pub fn new_unchecked(buffer: T) -> NdiscOption<T>
Create a raw octet buffer with an NDISC Option structure.
sourcepub fn new_checked(buffer: T) -> Result<NdiscOption<T>>
pub fn new_checked(buffer: T) -> Result<NdiscOption<T>>
Shorthand for a combination of new_unchecked and check_len.
sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated) if the buffer is too short.
The result of this check is invalidated by calling set_data_len.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the NDISC option, returning the underlying buffer.
sourcepub fn option_type(&self) -> Type
pub fn option_type(&self) -> Type
Return the option type.
sourceimpl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for Source/Target Link-layer Address options.
sourcepub fn link_layer_addr(&self) -> RawHardwareAddress
pub fn link_layer_addr(&self) -> RawHardwareAddress
Return the Source/Target Link-layer Address.
sourceimpl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for the MTU option.
sourceimpl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for the Prefix Information option.
sourcepub fn prefix_len(&self) -> u8
pub fn prefix_len(&self) -> u8
Return the prefix length.
sourcepub fn prefix_flags(&self) -> PrefixInfoFlags
pub fn prefix_flags(&self) -> PrefixInfoFlags
Return the prefix information flags.
sourcepub fn valid_lifetime(&self) -> Duration
pub fn valid_lifetime(&self) -> Duration
Return the valid lifetime of the prefix.
sourcepub fn preferred_lifetime(&self) -> Duration
pub fn preferred_lifetime(&self) -> Duration
Return the preferred lifetime of the prefix.
sourcepub fn prefix(&self) -> Ipv6Address
pub fn prefix(&self) -> Ipv6Address
Return the prefix.
sourceimpl<'a, T: AsRef<[u8]> + ?Sized> NdiscOption<&'a T>
impl<'a, T: AsRef<[u8]> + ?Sized> NdiscOption<&'a T>
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Core setter methods relevant to any type of NDISC option.
sourcepub fn set_option_type(&mut self, value: Type)
pub fn set_option_type(&mut self, value: Type)
Set the option type.
sourcepub fn set_data_len(&mut self, value: u8)
pub fn set_data_len(&mut self, value: u8)
Set the option data length.
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for Source/Target Link-layer Address options.
sourcepub fn set_link_layer_addr(&mut self, addr: RawHardwareAddress)
pub fn set_link_layer_addr(&mut self, addr: RawHardwareAddress)
Set the Source/Target Link-layer Address.
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the MTU option.
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the Prefix Information option.
sourcepub fn set_prefix_len(&mut self, value: u8)
pub fn set_prefix_len(&mut self, value: u8)
Set the prefix length.
sourcepub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)
pub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)
Set the prefix information flags.
sourcepub fn set_valid_lifetime(&mut self, time: Duration)
pub fn set_valid_lifetime(&mut self, time: Duration)
Set the valid lifetime of the prefix.
sourcepub fn set_preferred_lifetime(&mut self, time: Duration)
pub fn set_preferred_lifetime(&mut self, time: Duration)
Set the preferred lifetime of the prefix.
sourcepub fn clear_prefix_reserved(&mut self)
pub fn clear_prefix_reserved(&mut self)
Clear the reserved bits.
sourcepub fn set_prefix(&mut self, addr: Ipv6Address)
pub fn set_prefix(&mut self, addr: Ipv6Address)
Set the prefix.
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the Redirected Header option.
sourcepub fn clear_redirected_reserved(&mut self)
pub fn clear_redirected_reserved(&mut self)
Clear the reserved bits.
sourceimpl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> NdiscOption<&'a mut T>
impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> NdiscOption<&'a mut T>
Trait Implementations
sourceimpl<T: Debug + AsRef<[u8]>> Debug for NdiscOption<T>
impl<T: Debug + AsRef<[u8]>> Debug for NdiscOption<T>
sourceimpl<'a, T: AsRef<[u8]> + ?Sized> Display for NdiscOption<&'a T>
impl<'a, T: AsRef<[u8]> + ?Sized> Display for NdiscOption<&'a T>
sourceimpl<T: PartialEq + AsRef<[u8]>> PartialEq<NdiscOption<T>> for NdiscOption<T>
impl<T: PartialEq + AsRef<[u8]>> PartialEq<NdiscOption<T>> for NdiscOption<T>
sourcefn eq(&self, other: &NdiscOption<T>) -> bool
fn eq(&self, other: &NdiscOption<T>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &NdiscOption<T>) -> bool
fn ne(&self, other: &NdiscOption<T>) -> bool
This method tests for !=.
sourceimpl<T: AsRef<[u8]>> PrettyPrint for NdiscOption<T>
impl<T: AsRef<[u8]>> PrettyPrint for NdiscOption<T>
sourcefn pretty_print(
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter<'_>,
indent: &mut PrettyIndent
) -> Result
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
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more