async_session

Trait SessionStore

Source
pub trait SessionStore:
    Debug
    + Send
    + Sync
    + Clone
    + 'static {
    // Required methods
    fn load_session<'life0, 'async_trait>(
        &'life0 self,
        cookie_value: String,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_session<'life0, 'async_trait>(
        &'life0 self,
        session: Session,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn destroy_session<'life0, 'async_trait>(
        &'life0 self,
        session: Session,
    ) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_store<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An async session backend.

Required Methods§

Source

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

Get a session from the storage backend.

The input is expected to be the value of an identifying cookie. This will then be parsed by the session middleware into a session if possible

Source

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

Store a session on the storage backend.

The return value is the value of the cookie to store for the user that represents this session

Source

fn destroy_session<'life0, 'async_trait>( &'life0 self, session: Session, ) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a session from the session store

Source

fn clear_store<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Empties the entire store, destroying all sessions

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§