pub struct SubdomainResolver { /* private fields */ }Expand description
Resolves tenant from the Host header subdomain.
Extracts the leftmost subdomain segment by stripping the rightmost
base_domain_parts segments. For example, with base_domain_parts = 2:
acme.yourapp.com→ slug"acme"yourapp.com→None(no subdomain)acme.yourapp.com:8080→ slug"acme"(port stripped)
§Example
ⓘ
use ferro_rs::tenant::{SubdomainResolver, DbTenantLookup};
use std::sync::Arc;
let resolver = SubdomainResolver::new(2, Arc::new(lookup));Implementations§
Source§impl SubdomainResolver
impl SubdomainResolver
Sourcepub fn new(
base_domain_parts: usize,
tenant_lookup: Arc<dyn TenantLookup>,
) -> Self
pub fn new( base_domain_parts: usize, tenant_lookup: Arc<dyn TenantLookup>, ) -> Self
Create a new SubdomainResolver.
base_domain_parts— number of base domain segments to strip (e.g. 2 foryourapp.com)tenant_lookup— lookup implementation for DB verification
Trait Implementations§
Source§impl TenantResolver for SubdomainResolver
impl TenantResolver for SubdomainResolver
Auto Trait Implementations§
impl Freeze for SubdomainResolver
impl !RefUnwindSafe for SubdomainResolver
impl Send for SubdomainResolver
impl Sync for SubdomainResolver
impl Unpin for SubdomainResolver
impl UnsafeUnpin for SubdomainResolver
impl !UnwindSafe for SubdomainResolver
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more