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>;
}
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 the [Blocking
] 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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.