Skip to main content

TenantResolver

Trait TenantResolver 

Source
pub trait TenantResolver:
    Send
    + Sync
    + 'static {
    type Tenant: HasTenantId + Send + Sync + Clone + 'static;

    // Required method
    fn resolve(
        &self,
        id: &TenantId,
    ) -> impl Future<Output = Result<Self::Tenant>> + Send;
}
Expand description

Resolves a TenantId to an app-defined tenant type.

Uses RPITIT so it is not object-safe; the resolver must be a concrete type.

Required Associated Types§

Source

type Tenant: HasTenantId + Send + Sync + Clone + 'static

The resolved tenant type.

Required Methods§

Source

fn resolve( &self, id: &TenantId, ) -> impl Future<Output = Result<Self::Tenant>> + Send

Look up a tenant by the extracted identifier.

§Errors

Returns Error when the tenant cannot be found or the lookup fails (e.g., database error).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§