pub struct Scoped<T>(pub Arc<T>);Expand description
Resolves a provider of type T from the current request’s
RequestScope. Rejects with 500 if the scope is absent (a transport
wiring bug) or if no provider is registered for T.
Tuple Fields§
§0: Arc<T>Implementations§
Trait Implementations§
Source§impl<'a, T: Send + Sync + 'static> FromRequest<'a> for Scoped<T>
impl<'a, T: Send + Sync + 'static> FromRequest<'a> for Scoped<T>
Source§async fn from_request(req: &'a Request, _body: &mut RequestBody) -> Result<Self>
async fn from_request(req: &'a Request, _body: &mut RequestBody) -> Result<Self>
Extract from request head and body.
Auto Trait Implementations§
impl<T> Freeze for Scoped<T>
impl<T> RefUnwindSafe for Scoped<T>where
T: RefUnwindSafe,
impl<T> Send for Scoped<T>
impl<T> Sync for Scoped<T>
impl<T> Unpin for Scoped<T>
impl<T> UnsafeUnpin for Scoped<T>
impl<T> UnwindSafe for Scoped<T>where
T: RefUnwindSafe,
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> TowerCompatExt for T
impl<T> TowerCompatExt for T
Source§fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
<ResBody as Body>::Data: Into<Bytes> + Send + 'static,
<ResBody as Body>::Error: Error + Send + Sync + 'static,
Err: Into<Error>,
Self: Sized + Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
<ResBody as Body>::Data: Into<Bytes> + Send + 'static,
<ResBody as Body>::Error: Error + Send + Sync + 'static,
Err: Into<Error>,
Self: Sized + Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
Converts a tower service to a poem endpoint.