Struct Pumped
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§
§impl Pumped
impl Pumped
pub fn starting_at(now: Instant) -> Pumped
pub fn background(&self) -> Background
pub 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)
pub fn advance(&self, by: Duration)
Move the virtual clock forward by by, firing every timer that falls
due in deadline order and running the work each one releases.
pub 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 next_deadline(&self) -> Option<Instant>
The earliest armed timer, if any.
Trait Implementations§
§impl Executor for Pumped
impl Executor for Pumped
§fn park(&self, deadline: Instant)
fn park(&self, deadline: Instant)
Runs queued work; with none queued, advances the virtual clock to the
next timer or to deadline, whichever comes first.
§fn wake_at(&self, deadline: Instant, wake: WakeHandle)
fn wake_at(&self, deadline: Instant, wake: WakeHandle)
WakeHandle::wake on wake once now reaches
deadline. A deadline already in the past wakes promptly.Auto Trait Implementations§
impl Freeze 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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