Struct diem_time_service::mock::MockTimeService [−][src]
pub struct MockTimeService { /* fields omitted */ }Expand description
A TimeService that simulates time and allows for
fine-grained control over advancing time and waking up sleeping tasks.
Auto Advance
MockTimeService has the option to auto advance time when new Sleeps are
crated. When we’re auto advancing, new Sleeps are immediately resolved and
the simulation time is advanced to the wait deadline. New Sleeps whose deadlines
are after the auto advance deadline will be pending and must be manually
woken by the MockTimeService::advance_{..} methods.
Implementations
Create a new MockTimeService with no auto advance. Time will only advance
by manually calling the MockTimeService::advance_{..} methods.
Create a new MockTimeService that will auto advance forever.
Create a new MockTimeService that will auto advance until the simulation
time passes deadline.
Return the number of pending Sleep waiters.
Advance time to the next pending waiter, wake it up, and return the wake
time, or None if there are no waiters.
Advance time by duration and wake any pending waiters whose sleep has
expired. Return the number of waiters that we woke up.
Advance time by duration seconds. See advance.
Advance time by duration milliseconds. See advance.
Advance time to the next pending waiter, wake it up, and return the wake
time, or None if there are no waiters.
Yields to the executor to run any freshly awoken tasks (which might also
create more Sleep futures).
Advance time by duration and wake any pending waiters whose sleep has
expired. Return the number of waiters that we woke up.
Yields to the executor to run any freshly awoken tasks (which might also
create more Sleep futures).
Advance time by duration seconds.
See advance_async.
Advance time by duration milliseconds.
See advance_async.
Trait Implementations
Performs the conversion.
Query a monotonically nondecreasing clock. Returns an opaque type that
can only be compared to other Instants, i.e., this is a monotonic
relative time whereas now_unix_time is a
non-monotonic absolute time. Read more
Blocks the current thread until duration time has passed.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for MockTimeService
impl Send for MockTimeService
impl Sync for MockTimeService
impl Unpin for MockTimeService
impl UnwindSafe for MockTimeService
Blanket Implementations
Mutably borrows from an owned value. Read more