pub trait EventListenerFuture {
type Output;
// Required method
fn poll_with_strategy<'a, S: Strategy<'a>>(
self: Pin<&mut Self>,
strategy: &mut S,
context: &mut S::Context
) -> Poll<Self::Output>;
// Provided method
fn wait(self) -> Self::Output
where Self: Sized { ... }
}
Expand description
A future that runs using the [event-listener
] crate.
This is similar to the Future
trait from libstd, with one notable difference: it takes
a strategy that tells it whether to operate in a blocking or non-blocking context. The
poll_with_strategy
method is the equivalent of the poll
method in this regard; it uses
the Strategy
trait to determine how to poll the future.
From here, there are two additional things one can do with this trait:
- The
wait
method, which uses theBlocking
strategy to poll the future until it is ready, blocking the current thread until it is. - The
FutureWrapper
type, which implementsFuture
and uses theNonBlocking
strategy to poll the future.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn wait(self) -> Self::Outputwhere
Self: Sized,
fn wait(self) -> Self::Outputwhere
Self: Sized,
Wait for the future to complete, blocking the current thread.
This function uses the Blocking
strategy to poll the future until it is ready.
The future should only return Pending
if Strategy::poll
returns error. Otherwise,
this function polls the future in a hot loop.
Object Safety§
This trait is not object safe.