Skip to main content

Worker

Trait Worker 

Source
pub trait Worker<C>:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(&self, cx: Context<C>) -> impl Future<Output = Outcome> + Send;
}
Expand description

Handles one request of a crawl.

The worker receives a Context holding the request and a client for it. It decides when, and whether, to fetch the response, may queue further requests, and tells the crawler what to do next.

Required Methods§

Source

fn handle(&self, cx: Context<C>) -> impl Future<Output = Outcome> + Send

Handles the request in cx.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C, F, Fut> Worker<C> for FromFn<F>
where C: Send + 'static, F: Fn(Context<C>) -> Fut + Send + Sync + 'static, Fut: Future + Send, <Fut as Future>::Output: IntoOutcome,

Source§

impl<C, S> Worker<C> for Router<C, S>
where C: Send + Sync + 'static, S: Send + Sync + 'static,

Source§

impl<M, C> Worker<C> for Layered<M, C>
where M: Middleware<C>, C: Send + 'static,