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§
Sourcetype Error: IntoResponse + Send + Sync + 'static
type Error: IntoResponse + Send + Sync + 'static
Error type when dependency resolution fails.
Required Methods§
Sourcefn from_dependency(
ctx: &RequestContext,
req: &mut Request,
) -> impl Future<Output = Result<Self, Self::Error>> + Send
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", so this trait is not object safe.