pub struct Tenant<T>(/* private fields */);Expand description
Axum extractor that provides access to the resolved tenant.
Pulls the resolved tenant from request extensions (inserted by
TenantMiddleware). Returns HTTP 500 if the
middleware has not been applied – this indicates a developer misconfiguration.
Use Option<Tenant<T>> for routes that work with or without a tenant
(the OptionalFromRequestParts impl returns Ok(None) instead of an error).
Implementations§
Trait Implementations§
Source§impl<T, S> FromRequestParts<S> for Tenant<T>
impl<T, S> FromRequestParts<S> for Tenant<T>
Source§impl<T, S> OptionalFromRequestParts<S> for Tenant<T>
impl<T, S> OptionalFromRequestParts<S> for Tenant<T>
Auto Trait Implementations§
impl<T> Freeze for Tenant<T>
impl<T> RefUnwindSafe for Tenant<T>where
T: RefUnwindSafe,
impl<T> Send for Tenant<T>
impl<T> Sync for Tenant<T>
impl<T> Unpin for Tenant<T>
impl<T> UnsafeUnpin for Tenant<T>
impl<T> UnwindSafe for Tenant<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.