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§
sourcefn iter(&self) -> NetworksIter<'_> ⓘ
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());
}
sourcefn refresh_networks_list(&mut self)
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();