pub trait WorkerExpiration:
'static
+ Send
+ Sync {
// Required method
fn poll(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
state: WorkerStatus,
start: Instant,
) -> Poll<()>;
}component-model-async only.Expand description
Represents the application-specific state of a ProxyHandler worker.
HandlerState::instantiate returns an implementation of this trait for
each component instance (and thus each worker) created. The worker uses it
to determine when to exit.
Required Methods§
Sourcefn poll(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
state: WorkerStatus,
start: Instant,
) -> Poll<()>
fn poll( self: Pin<&mut Self>, cx: &mut Context<'_>, state: WorkerStatus, start: Instant, ) -> Poll<()>
Poll whether the worker has expired.
This will return Poll::Ready(()) if the worker has expired, meaning
the component instance should be dropped. Otherwise, it will return
Poll::Pending and wake the Waker if and when it should be polled
again.
state represents the current state of the worker, and start
represents when it transitioned into that state (or in the case of
WorkerState::Requests, when the most recent outstanding request
was accepted).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".