Skip to main content

FetchHandler

Trait FetchHandler 

Source
pub trait FetchHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn complete(self: Box<Self>, result: Result<FetchResponse, FetchError>);
}
Expand description

Receives the result of one FetchProvider::fetch.

Takes self: Box<Self> so that a handler can be consumed by completing, which makes “completed twice” unrepresentable rather than merely wrong. Same shape as NetHandler.

Required Methods§

Source

fn complete(self: Box<Self>, result: Result<FetchResponse, FetchError>)

Called exactly once.

A response with a non-success status is Ok, not Err. A 404 has a status, headers and usually a body, all of which the caller asked for. FetchError is for the cases where there is no response at all.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§