pub trait AnySessionMethod:
AnyExt
+ DatabaseConsumer
+ Serialize
+ Deserialize {
// Required methods
fn check<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
token: CompactString,
) -> Pin<Box<dyn Future<Output = Result<Option<UserId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn new<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
) -> Pin<Box<dyn Future<Output = Result<CompactString>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn invalidate<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
token: Option<CompactString>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_expired<'life0, 'async_trait>(
&'life0 self,
db_conn: Arc<dyn AnyDatabaseConnection>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn max_age(&self) -> Option<usize> { ... }
}Expand description
Trait implemented for every session’s storage backend.
Required Methods§
Sourcefn check<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
token: CompactString,
) -> Pin<Box<dyn Future<Output = Result<Option<UserId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
token: CompactString,
) -> Pin<Box<dyn Future<Output = Result<Option<UserId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get whether a user is authenticated by the given session token.
Sourcefn new<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
) -> Pin<Box<dyn Future<Output = Result<CompactString>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
) -> Pin<Box<dyn Future<Output = Result<CompactString>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new session for the given user.
Sourcefn invalidate<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
token: Option<CompactString>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invalidate<'life0, 'async_trait>(
&'life0 self,
db_conns: DbConns,
user_id: UserId,
token: Option<CompactString>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invalidate all session’s of the given user.
Sourcefn remove_expired<'life0, 'async_trait>(
&'life0 self,
db_conn: Arc<dyn AnyDatabaseConnection>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_expired<'life0, 'async_trait>(
&'life0 self,
db_conn: Arc<dyn AnyDatabaseConnection>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove all the expired sessions.
Provided Methods§
Trait Implementations§
Source§impl<'typetag> Serialize for dyn AnySessionMethod + 'typetag
impl<'typetag> Serialize for dyn AnySessionMethod + 'typetag
Source§impl<'typetag> Serialize for dyn AnySessionMethod + Send + 'typetag
impl<'typetag> Serialize for dyn AnySessionMethod + Send + 'typetag
Source§impl<'typetag> Serialize for dyn AnySessionMethod + Sync + 'typetag
impl<'typetag> Serialize for dyn AnySessionMethod + Sync + 'typetag
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".