Trait sysinfo::NetworksExt

source ·
pub trait NetworksExt: Debug {
    // Required methods
    fn iter(&self) -> NetworksIter<'_> ;
    fn refresh_networks_list(&mut self);
    fn refresh(&mut self);
}
Expand description

Interacting with network interfaces.

Required Methods§

source

fn iter(&self) -> NetworksIter<'_>

Returns an iterator over the network interfaces.

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 refresh_networks_list(&mut self)

Refreshes the network interfaces list.

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

let mut s = System::new_all();
let networks = s.networks_mut();
networks.refresh_networks_list();
source

fn refresh(&mut self)

Refreshes the network interfaces’ content.

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

let mut s = System::new_all();
let networks = s.networks_mut();
networks.refresh();

Implementors§