pub struct Scoped<T>(pub T);Expand description
Extractor for request-scoped dependencies.
If a dependency T was injected into the current request (e.g. via App::scoped_state),
this extractor will retrieve it. Otherwise, it fails with a 500 Internal Server Error.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<S, T> FromRequestParts<S> for Scoped<T>
impl<S, T> FromRequestParts<S> for Scoped<T>
Auto Trait Implementations§
impl<T> Freeze for Scoped<T>where
T: Freeze,
impl<T> RefUnwindSafe for Scoped<T>where
T: RefUnwindSafe,
impl<T> Send for Scoped<T>where
T: Send,
impl<T> Sync for Scoped<T>where
T: Sync,
impl<T> Unpin for Scoped<T>where
T: Unpin,
impl<T> UnsafeUnpin for Scoped<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Scoped<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.