pub trait SessionKey:
Send
+ Sync
+ 'static {
const KEY: &'static str;
}Available on crate feature
sessions and crate feature middleware and native only.Expand description
Marker trait identifying a session-storage key at the type level.
Implementors are zero-sized marker types similar to
reinhardt_di::params::CookieName — define one type per logical key
and reuse it across handlers:
ⓘ
use reinhardt::middleware::session::{SessionKey, SessionValueNamed};
pub struct TenantIdKey;
impl SessionKey for TenantIdKey {
const KEY: &'static str = "tenant_id";
}
#[server_fn]
pub async fn current_tenant(
SessionValueNamed::<TenantIdKey, i64>(tenant_id): SessionValueNamed<TenantIdKey, i64>,
) -> Result<TenantInfo, ServerFnError> { /* ... */ }Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".