Function mprober_lib::network::get_networks_with_speed [−][src]
pub fn get_networks_with_speed(
interval: Duration
) -> Result<Vec<(Network, NetworkSpeed)>, ScannerError>
Get network information by reading the /proc/net/dev
file and measure the speed within a specific time interval.
extern crate mprober_lib; use std::time::Duration; use mprober_lib::network; let networks_with_speed = network::get_networks_with_speed(Duration::from_millis(100)).unwrap(); for (network, network_speed) in networks_with_speed { println!("{}: ", network.interface); println!(" Receive: {:.1} B/s", network_speed.receive); println!(" Transmit: {:.1} B/s", network_speed.transmit); }