pub struct Tenanted<S: TenantScopedStore> { /* private fields */ }Expand description
A tenant-scoped wrapper around a storage handle.
Tenanted<S> is the only legal carrier for a storage handle inside an
activation. The inner store is module-private; the constructor is
crate-private; the only public access path is scoped,
which requires a &Tenant.
§Construction
Activation code never constructs a Tenanted<S> directly. The
framework’s hub-builder layer (a follow-up ticket) accepts a bare S
and hands a Tenanted<S> to the activation at startup. Inside
plexus-auth-core, the crate-private new_sealed is the only
constructor.
§Sealing
- No fabrication. Constructor is
pub(crate). - No inner reach. The
innerfield is module-private; activation code that writesself.store.inner.method()fails to compile. - No
Default. Not derived; a default-constructed wrapper would widen the access boundary silently. - No
Deserialize. Not derived; the wrapper is not transport.
Implementations§
Source§impl<S: TenantScopedStore> Tenanted<S>
impl<S: TenantScopedStore> Tenanted<S>
Sourcepub fn scoped<'a>(&'a self, tenant: &'a Tenant) -> Scoped<'a, S>
pub fn scoped<'a>(&'a self, tenant: &'a Tenant) -> Scoped<'a, S>
Bind the wrapper to a tenant, returning a Scoped<'a, S>
borrow.
The returned borrow’s lifetime is the shorter of the wrapper’s
borrow and the tenant’s borrow. The activation’s domain methods,
defined on Scoped<'_, S> via a trait (because Rust’s orphan
rule forbids inherent impls on a foreign type), read both
self.store() and self.tenant() to bind the active tenant
into every query.