Trait async_session::SessionStore[][src]

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

An async session backend.

Required methods

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

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

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

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

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

Remove a session from the session store

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

Empties the entire store, destroying all sessions

Implementors

impl SessionStore for CookieStore[src]

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

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

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

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

impl SessionStore for MemoryStore[src]

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

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

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

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