Trait sysinfo::NetworkExt

source ·
pub trait NetworkExt: Debug {
Show 13 methods // Required methods fn received(&self) -> u64; fn total_received(&self) -> u64; fn transmitted(&self) -> u64; fn total_transmitted(&self) -> u64; fn packets_received(&self) -> u64; fn total_packets_received(&self) -> u64; fn packets_transmitted(&self) -> u64; fn total_packets_transmitted(&self) -> u64; fn errors_on_received(&self) -> u64; fn total_errors_on_received(&self) -> u64; fn errors_on_transmitted(&self) -> u64; fn total_errors_on_transmitted(&self) -> u64; fn mac_address(&self) -> MacAddr;
}
Expand description

Getting volume of received and transmitted data.

Required Methods§

source

fn received(&self) -> u64

Returns the number of received bytes since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {} B", network.received());
}
source

fn total_received(&self) -> u64

Returns the total number of received bytes.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {} B", network.total_received());
}
source

fn transmitted(&self) -> u64

Returns the number of transmitted bytes since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {} B", network.transmitted());
}
source

fn total_transmitted(&self) -> u64

Returns the total number of transmitted bytes.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {} B", network.total_transmitted());
}
source

fn packets_received(&self) -> u64

Returns the number of incoming packets since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {}", network.packets_received());
}
source

fn total_packets_received(&self) -> u64

Returns the total number of incoming packets.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {}", network.total_packets_received());
}
source

fn packets_transmitted(&self) -> u64

Returns the number of outcoming packets since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {}", network.packets_transmitted());
}
source

fn total_packets_transmitted(&self) -> u64

Returns the total number of outcoming packets.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {}", network.total_packets_transmitted());
}
source

fn errors_on_received(&self) -> u64

Returns the number of incoming errors since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {}", network.errors_on_received());
}
source

fn total_errors_on_received(&self) -> u64

Returns the total number of incoming errors.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("in: {}", network.total_errors_on_received());
}
source

fn errors_on_transmitted(&self) -> u64

Returns the number of outcoming errors since the last refresh.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {}", network.errors_on_transmitted());
}
source

fn total_errors_on_transmitted(&self) -> u64

Returns the total number of outcoming errors.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("out: {}", network.total_errors_on_transmitted());
}
source

fn mac_address(&self) -> MacAddr

Returns the MAC address associated to current interface.

use sysinfo::{NetworkExt, NetworksExt, System, SystemExt};

let s = System::new_all();
let networks = s.networks();
for (interface_name, network) in networks {
    println!("MAC address: {}", network.mac_address());
}

Implementors§