Struct async_speed_limit::clock::ManualClock [−][src]
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
impl ManualClock
[src]
pub fn new() -> Self
[src]
Creates a new clock with time set to 0.
pub fn set_time(&self, time: Nanoseconds)
[src]
Trait Implementations
impl Clock for ManualClock
[src]
type Instant = Nanoseconds
Type to represent a point of time. Read more
type Delay = ManualDelay
Future type returned by sleep()
.
fn now(&self) -> Self::Instant
[src]
fn sleep(&self, dur: Duration) -> Self::Delay
[src]
impl Clone for ManualClock
[src]
fn clone(&self) -> ManualClock
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ManualClock
[src]
impl Default for ManualClock
[src]
fn default() -> ManualClock
[src]
Auto Trait Implementations
impl RefUnwindSafe for ManualClock
impl Send for ManualClock
impl Sync for ManualClock
impl Unpin for ManualClock
impl UnwindSafe for ManualClock
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,