pub trait FromRequestParts: Sized + Send {
const BACKGROUND_TASKS: bool = false;
// Required method
fn from_request_parts(
parts: &mut Parts,
) -> impl Future<Output = Result<Self, ApiError>> + Send;
// Provided method
fn describe(_op: &mut Operation, _registry: &mut SchemaRegistry) { ... }
}Expand description
Extract a value from request metadata (method, URI, headers, extensions).
Provided Associated Constants§
Sourceconst BACKGROUND_TASKS: bool = false
const BACKGROUND_TASKS: bool = false
Whether extraction needs a request-owned background queue. Custom wrappers delegating to BackgroundTasks must propagate this.
Required Methods§
Provided Methods§
Sourcefn describe(_op: &mut Operation, _registry: &mut SchemaRegistry)
fn describe(_op: &mut Operation, _registry: &mut SchemaRegistry)
Document this extractor on op (parameters, security, …).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: FromRequestParts> FromRequestParts for Option<T>
Optional extraction: None when the input is absent, the error otherwise.
impl<T: FromRequestParts> FromRequestParts for Option<T>
Optional extraction: None when the input is absent, the error otherwise.
Only errors marked ApiError::absent become None; a header, query
string or credential that is present but invalid still fails the request.
Source§fn describe(op: &mut Operation, registry: &mut SchemaRegistry)
fn describe(op: &mut Operation, registry: &mut SchemaRegistry)
Documents T, with everything it adds marked optional. Security
schemes it requires become an alternative next to the requirements
that held before.
const BACKGROUND_TASKS: bool = T::BACKGROUND_TASKS
async fn from_request_parts(parts: &mut Parts) -> Result<Self, ApiError>
Implementors§
Source§impl FromRequestParts for BackgroundTasks
impl FromRequestParts for BackgroundTasks
const BACKGROUND_TASKS: bool = true
impl FromRequestParts for Cookies
impl FromRequestParts for HeaderMap
All request headers.
impl FromRequestParts for HttpBasic
impl FromRequestParts for HttpBearer
impl FromRequestParts for Method
The request method.
impl FromRequestParts for Readiness
impl FromRequestParts for RequestId
impl FromRequestParts for Uri
The request URI.