[−][src]Struct mprober_lib::network::NetworkStat
Fields
receive_bytes: u64transmit_bytes: u64Implementations
impl NetworkStat[src]
pub fn compute_speed(
&self,
network_stat_after_this: &NetworkStat,
interval: Duration
) -> NetworkSpeed[src]
&self,
network_stat_after_this: &NetworkStat,
interval: Duration
) -> NetworkSpeed
Calculate speed between two NetworkStat instances at different time.
extern crate mprober_lib; use std::thread::sleep; use std::time::Duration; use mprober_lib::network; let pre_networks = network::get_networks().unwrap(); let interval = Duration::from_millis(100); sleep(interval); let networks = network::get_networks().unwrap(); if !pre_networks.is_empty() && !networks.is_empty() { let network_speed = pre_networks[0].stat.compute_speed(&networks[0].stat, interval); println!("Receive: {:.1} B/s", network_speed.receive); println!("Transmit: {:.1} B/s", network_speed.transmit); }
Trait Implementations
impl Clone for NetworkStat[src]
fn clone(&self) -> NetworkStat[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for NetworkStat[src]
impl Default for NetworkStat[src]
fn default() -> NetworkStat[src]
impl Eq for NetworkStat[src]
impl PartialEq<NetworkStat> for NetworkStat[src]
fn eq(&self, other: &NetworkStat) -> bool[src]
fn ne(&self, other: &NetworkStat) -> bool[src]
impl StructuralEq for NetworkStat[src]
impl StructuralPartialEq for NetworkStat[src]
Auto Trait Implementations
impl RefUnwindSafe for NetworkStat
impl Send for NetworkStat
impl Sync for NetworkStat
impl Unpin for NetworkStat
impl UnwindSafe for NetworkStat
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,