Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 String,
    ) -> Pin<Box<dyn Future<Output = Option<Session>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: &'life1 String,
        session: &'life2 Session,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 String,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn create_session_id(&self) -> String { ... }
}
Available on native and crate feature auth only.
Expand description

Session store trait for different backends

Required Methods§

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 String, ) -> Pin<Box<dyn Future<Output = Option<Session>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Load session data by session ID

Source

fn save<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 String, session: &'life2 Session, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Save session data

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Delete session data

Provided Methods§

Source

fn create_session_id(&self) -> String

Create a new session ID

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§