Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn load(
        &self,
        id: &str,
    ) -> Result<Option<HashMap<String, String>>, SessionError>;
    fn save(
        &self,
        id: &str,
        attributes: &HashMap<String, String>,
    ) -> Result<(), SessionError>;
    fn delete(&self, id: &str) -> Result<(), SessionError>;
}
Expand description

Loads and saves session attribute maps by id.

Required Methods§

Source

fn load( &self, id: &str, ) -> Result<Option<HashMap<String, String>>, SessionError>

Returns stored attributes for id, or None when unknown.

§Errors

Returns SessionError when the backend fails.

Source

fn save( &self, id: &str, attributes: &HashMap<String, String>, ) -> Result<(), SessionError>

Persists attributes for id.

§Errors

Returns SessionError when the backend fails.

Source

fn delete(&self, id: &str) -> Result<(), SessionError>

Deletes id when present.

§Errors

Returns SessionError when the backend fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§