pub struct ManualClock(/* private fields */);
Expand description
A Clock
where the passage of time can be manually controlled.
This type is mainly used for testing behavior of speed limiter only.
This clock only supports up to 264 ns (about 584.5 years).
§Examples
use async_speed_limit::clock::{Clock, ManualClock, Nanoseconds};
let clock = ManualClock::new();
assert_eq!(clock.now(), Nanoseconds(0));
clock.set_time(Nanoseconds(1_000_000_000));
assert_eq!(clock.now(), Nanoseconds(1_000_000_000));
Implementations§
Source§impl ManualClock
impl ManualClock
Trait Implementations§
Source§impl Clock for ManualClock
impl Clock for ManualClock
Source§type Instant = Nanoseconds
type Instant = Nanoseconds
Type to represent a point of time. Read more
Source§type Delay = ManualDelay
type Delay = ManualDelay
Future type returned by
sleep()
.Source§impl Clone for ManualClock
impl Clone for ManualClock
Source§fn clone(&self) -> ManualClock
fn clone(&self) -> ManualClock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ManualClock
impl Debug for ManualClock
Source§impl Default for ManualClock
impl Default for ManualClock
Source§fn default() -> ManualClock
fn default() -> ManualClock
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ManualClock
impl RefUnwindSafe for ManualClock
impl Send for ManualClock
impl Sync for ManualClock
impl Unpin for ManualClock
impl UnwindSafe for ManualClock
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