Skip to main content

FromDependency

Trait FromDependency 

Source
pub trait FromDependency:
    Clone
    + Send
    + Sync
    + 'static {
    type Error: IntoResponse + Send + Sync + 'static;

    // Required method
    fn from_dependency(
        ctx: &RequestContext,
        req: &mut Request,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
}
Expand description

Trait for types that can be injected as dependencies.

Required Associated Types§

Source

type Error: IntoResponse + Send + Sync + 'static

Error type when dependency resolution fails.

Required Methods§

Source

fn from_dependency( ctx: &RequestContext, req: &mut Request, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Resolve the dependency.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§