Skip to main content

NetdevStats

Struct NetdevStats 

Source
#[non_exhaustive]
pub struct NetdevStats { pub in_octets: Option<u64>, pub out_octets: Option<u64>, pub in_errors: Option<u64>, pub out_errors: Option<u64>, pub in_discards: Option<u64>, pub out_discards: Option<u64>, pub in_multicast_pkts: Option<u64>, pub in_pkts: Option<u64>, pub out_pkts: Option<u64>, pub qdisc_backlog_bytes: Option<u64>, pub qdisc_backlog_pkts: Option<u64>, }
Expand description

A network interface’s counters (#130), with RFC 8343’s names where Linux keeps exactly that counter and nothing else.

in_pkts and out_pkts are not RFC 8343’s: the RFC splits packets by unicast, multicast and broadcast, Linux’s rx_packets includes multicast, and Linux keeps no broadcast counter. They are here because an operator asks for them; the registry says what they are.

#[non_exhaustive] since 0.3; built with NetdevStats::new and the setters, or Default.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§in_octets: Option<u64>

rx_bytes — RFC 8343 in-octets.

§out_octets: Option<u64>

tx_bytes — RFC 8343 out-octets.

§in_errors: Option<u64>

rx_errors — RFC 8343 in-errors.

§out_errors: Option<u64>

tx_errors — RFC 8343 out-errors.

§in_discards: Option<u64>

rx_dropped — RFC 8343 in-discards.

§out_discards: Option<u64>

tx_dropped — RFC 8343 out-discards.

§in_multicast_pkts: Option<u64>

multicast — RFC 8343 in-multicast-pkts.

§in_pkts: Option<u64>

rx_packets — not RFC 8343: unicast and multicast together.

§out_pkts: Option<u64>

tx_packets — not RFC 8343.

§qdisc_backlog_bytes: Option<u64>

Bytes queued in the interface’s queue discipline now, not yet sent (#136). Not a sysfs counter: read over netlink, and only from the kernel’s own interface. The queue an operator watches form when a bearer is slower than what is offered to it.

§qdisc_backlog_pkts: Option<u64>

Packets queued in the queue discipline now (#136).

Implementations§

Source§

impl NetdevStats

Source

pub fn new() -> Self

Every counter absent.

Source

pub fn in_octets(self, n: u64) -> Self

With in_octets.

Source

pub fn out_octets(self, n: u64) -> Self

With out_octets.

Source

pub fn in_errors(self, n: u64) -> Self

With in_errors.

Source

pub fn out_errors(self, n: u64) -> Self

With out_errors.

Source

pub fn in_discards(self, n: u64) -> Self

With in_discards.

Source

pub fn out_discards(self, n: u64) -> Self

With out_discards.

Source

pub fn in_multicast_pkts(self, n: u64) -> Self

With in_multicast_pkts.

Source

pub fn in_pkts(self, n: u64) -> Self

With in_pkts.

Source

pub fn out_pkts(self, n: u64) -> Self

With out_pkts.

Source

pub fn qdisc_backlog_bytes(self, n: u64) -> Self

With qdisc_backlog_bytes.

Source

pub fn qdisc_backlog_pkts(self, n: u64) -> Self

With qdisc_backlog_pkts.

Trait Implementations§

Source§

impl Clone for NetdevStats

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for NetdevStats

Source§

impl Debug for NetdevStats

Source§

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

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

impl Default for NetdevStats

Source§

fn default() -> Self

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

impl Eq for NetdevStats

Source§

impl PartialEq for NetdevStats

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NetdevStats

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.