pub struct MinRate {
pub bytes_per_sec: u32,
pub window: Duration,
pub grace: Duration,
pub check: Duration,
}Expand description
A minimum transfer rate, checked per direction while that direction is active.
§Examples
use std::time::Duration;
let rate = net_io::MinRate::new(512, Duration::from_secs(10));
assert_eq!(rate.grace, Duration::from_secs(5));
assert!(net_io::MinRate::off().is_off());Fields§
§bytes_per_sec: u32Bytes per second the peer must reach over the window.
window: DurationThe sliding window.
grace: DurationHow long after a direction becomes active the check starts.
check: DurationHow often the rate is checked.
Implementations§
Trait Implementations§
impl Copy for MinRate
impl Eq for MinRate
impl StructuralPartialEq for MinRate
Auto Trait Implementations§
impl Freeze for MinRate
impl RefUnwindSafe for MinRate
impl Send for MinRate
impl Sync for MinRate
impl Unpin for MinRate
impl UnsafeUnpin for MinRate
impl UnwindSafe for MinRate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more