pub struct Pumped { /* private fields */ }Expand description
An executor that runs nothing until its owner pumps it.
Jobs queue until run_pending; timers fire when
advance moves the virtual clock past their deadline.
Headless tests use it to make background completion deterministic, and a
host that drives work from its own loop can install it and pump it there.
Implementations§
Source§impl Pumped
impl Pumped
pub fn new() -> Self
pub fn starting_at(now: Instant) -> Self
pub fn background(&self) -> Background
Sourcepub fn run_pending(&self) -> usize
pub fn run_pending(&self) -> usize
Run queued jobs, including any they queue, until none remain. Returns how many ran.
pub fn advance(&self, by: Duration)
Sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Whether no job is queued. Armed timers do not count: a periodic refresh is always armed.
pub fn next_deadline(&self) -> Option<Instant>
pub fn now(&self) -> Instant
Trait Implementations§
Auto Trait Implementations§
impl Forget for Pumped
impl Freeze for Pumped
impl Move for Pumped
impl RefUnwindSafe for Pumped
impl Send for Pumped
impl Sync for Pumped
impl Unpin for Pumped
impl UnsafeUnpin for Pumped
impl UnwindSafe for Pumped
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more