pub struct MatchedHost {
pub subdomain: String,
pub pattern: String,
}Expand description
Information about a wildcard host match.
Inserted into request extensions when a request matches a wildcard
pattern (e.g. *.acme.com). Not present for exact or fallback matches.
Use Option<MatchedHost> for handlers that serve both exact and wildcard
routes.
§Example
ⓘ
async fn handler(matched: MatchedHost) -> impl IntoResponse {
format!("subdomain: {}", matched.subdomain)
}Fields§
§subdomain: StringThe subdomain that matched (e.g. "tenant1" from "tenant1.acme.com").
pattern: StringThe wildcard pattern that matched (e.g. "*.acme.com").
Trait Implementations§
Source§impl Clone for MatchedHost
impl Clone for MatchedHost
Source§fn clone(&self) -> MatchedHost
fn clone(&self) -> MatchedHost
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MatchedHost
impl Debug for MatchedHost
Source§impl<S> FromRequestParts<S> for MatchedHost
impl<S> FromRequestParts<S> for MatchedHost
Source§impl<S> OptionalFromRequestParts<S> for MatchedHost
impl<S> OptionalFromRequestParts<S> for MatchedHost
Auto Trait Implementations§
impl Freeze for MatchedHost
impl RefUnwindSafe for MatchedHost
impl Send for MatchedHost
impl Sync for MatchedHost
impl Unpin for MatchedHost
impl UnsafeUnpin for MatchedHost
impl UnwindSafe for MatchedHost
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.