AddressMessage

Struct AddressMessage 

Source
pub struct AddressMessage { /* private fields */ }
Expand description

Strongly-typed address message with all attributes parsed.

Implementations§

Source§

impl AddressMessage

Source

pub fn new() -> Self

Create a new empty address message.

Source

pub fn family(&self) -> u8

Get the address family.

Source

pub fn prefix_len(&self) -> u8

Get the prefix length.

Source

pub fn ifindex(&self) -> u32

Get the interface index.

Source

pub fn scope(&self) -> Scope

Get the scope.

Source

pub fn address(&self) -> Option<&IpAddr>

Get the address.

Source

pub fn local(&self) -> Option<&IpAddr>

Get the local address.

Source

pub fn label(&self) -> Option<&str>

Get the interface label.

Source

pub fn broadcast(&self) -> Option<&IpAddr>

Get the broadcast address.

Source

pub fn anycast(&self) -> Option<&IpAddr>

Get the anycast address.

Source

pub fn flags(&self) -> u32

Get the extended flags.

Source

pub fn cache_info(&self) -> Option<&AddressCacheInfo>

Get the cache info.

Source

pub fn primary_address(&self) -> Option<&IpAddr>

Get the primary address (local or address).

For point-to-point links, local is the local address and address is the peer address. For other links, they are typically the same.

Source

pub fn is_ipv4(&self) -> bool

Check if this is an IPv4 address.

Source

pub fn is_ipv6(&self) -> bool

Check if this is an IPv6 address.

Source

pub fn is_secondary(&self) -> bool

Check if this is a secondary/temporary address.

Source

pub fn is_permanent(&self) -> bool

Check if this is a permanent address.

Source

pub fn is_deprecated(&self) -> bool

Check if this address is deprecated.

Source

pub fn is_tentative(&self) -> bool

Check if this address is tentative.

Trait Implementations§

Source§

impl Clone for AddressMessage

Source§

fn clone(&self) -> AddressMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AddressMessage

Source§

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

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

impl Default for AddressMessage

Source§

fn default() -> AddressMessage

Returns the “default value” for a type. Read more
Source§

fn write_dump_header(buf: &mut Vec<u8>)

Write the header required for dump requests. This is appended to the netlink message after the nlmsghdr. Default implementation writes nothing (for messages that don’t need a header).
Source§

fn parse(input: &mut &[u8]) -> PResult<Self>

Parse from a mutable byte slice reference. The slice is advanced past the consumed bytes.
Source§

fn from_bytes(data: &[u8]) -> Result<Self>

Parse from a complete byte slice.
Source§

impl Printable for AddressMessage

Source§

fn print_text<W: Write>(&self, w: &mut W, _opts: &OutputOptions) -> Result<()>

Print as plain text.
Source§

fn to_json(&self) -> Value

Convert to JSON value.
Source§

fn print<W: Write>( &self, w: &mut W, format: OutputFormat, opts: &OutputOptions, ) -> Result<()>

Print in the specified format.
Calculate the serialized size in bytes.
Source§

fn write_to(&self, buf: &mut Vec<u8>) -> Result<usize>

Write to a byte buffer. Returns the number of bytes written.
Source§

fn to_bytes(&self) -> Result<Vec<u8>>

Serialize to a new byte vector.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.