pub trait Driver<'a> {
// Required method
fn poll(
self: Pin<&mut Self>,
args: &mut Unstructured<'a>,
) -> Result<Poll<ControlFlow<()>>>;
}Expand description
The other side of the leaf future under test, responsible for making it progress.
For example:
- if the leaf future is the receiver of a channel, the driver is the sender.
- if the leaf future is a timeout, the driver is the timer system.
See drive_poll_fn, drive_fn, and drive_sink for convenient
constructors.
Required Methods§
Sourcefn poll(
self: Pin<&mut Self>,
args: &mut Unstructured<'a>,
) -> Result<Poll<ControlFlow<()>>>
fn poll( self: Pin<&mut Self>, args: &mut Unstructured<'a>, ) -> Result<Poll<ControlFlow<()>>>
Drive the leaf future to make progress.
Key invariant: when this returns Poll::Ready, the framework asserts
that the future’s waker was called. Return Poll::Pending if no progress
was made (e.g. the channel is full) to skip that assertion.
Poll::Ready(ControlFlow::Continue(()))– progress madePoll::Ready(ControlFlow::Break(()))– driver is done, exit after current future completesPoll::Pending– no progress
This function is allowed to block.