pub struct TenantConfig {
pub header_name: String,
pub required: bool,
pub fallback: Option<String>,
}Expand description
Configuration for tenant extraction via Tower middleware.
Fields§
§header_name: StringHeader name to read tenant ID from (default: “x-tenant-id”).
required: boolIf true, requests without tenant ID are rejected.
fallback: Option<String>Optional default tenant ID when header is missing and not required.
Implementations§
Source§impl TenantConfig
impl TenantConfig
Sourcepub fn tenant_from_headers(&self, headers: &HeaderMap) -> Option<TenantId>
pub fn tenant_from_headers(&self, headers: &HeaderMap) -> Option<TenantId>
Read a tenant id from headers according to this config.
Sourcepub const fn is_required(&self) -> bool
pub const fn is_required(&self) -> bool
Returns whether a request without tenant information should be rejected.
Trait Implementations§
Source§impl Clone for TenantConfig
impl Clone for TenantConfig
Source§fn clone(&self) -> TenantConfig
fn clone(&self) -> TenantConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TenantConfig
impl Debug for TenantConfig
Auto Trait Implementations§
impl Freeze for TenantConfig
impl RefUnwindSafe for TenantConfig
impl Send for TenantConfig
impl Sync for TenantConfig
impl Unpin for TenantConfig
impl UnsafeUnpin for TenantConfig
impl UnwindSafe for TenantConfig
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