pub struct Counter { /* private fields */ }Expand description
The timeout condition is independent of time
and is determined solely by the number of times timeout() is called.
§Examples
use waiter_trait::{prelude::*, Counter};
let c = Counter::new(0);
let mut t = c.start();
assert!(t.timeout());
assert!(t.timeout());
let c = Counter::new(usize::MAX);
let mut t = c.start();
assert!(!t.timeout());
assert!(!t.timeout());
let c = Counter::new(2);
let mut t = c.start();
assert!(!t.timeout());
assert!(!t.timeout());
assert!(t.timeout());
assert!(t.timeout());
t.restart();
assert!(!t.timeout());
assert!(!t.timeout());
assert!(t.timeout());
assert!(t.timeout());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Counter
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnwindSafe for Counter
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