Skip to main content

SessionConnExt

Trait SessionConnExt 

Source
pub trait SessionConnExt {
    // Required methods
    fn with_session(self, key: &str, value: impl Serialize) -> Self;
    fn session(&self) -> &Session;
    fn session_mut(&mut self) -> &mut Session;
    fn session_store_error(&self) -> Option<&SessionStoreError>;
}
Expand description

extension trait to add session support to Conn

SessionHandler MUST be called on the conn prior to using any of these functions.

Required Methods§

Source

fn with_session(self, key: &str, value: impl Serialize) -> Self

append a key-value pair to the current session, where the key is a &str and the value is anything serde-serializable.

Source

fn session(&self) -> &Session

retrieve a reference to the current session

Source

fn session_mut(&mut self) -> &mut Session

retrieve a mutable reference to the current session

Source

fn session_store_error(&self) -> Option<&SessionStoreError>

retrieve the error returned by the session store, if this request’s session could not be loaded

This is only ever present when the handler provided to SessionHandler::with_store_error_handler did not halt.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl SessionConnExt for Conn

Source§

fn session(&self) -> &Session

Source§

fn with_session(self, key: &str, value: impl Serialize) -> Self

Source§

fn session_mut(&mut self) -> &mut Session

Source§

fn session_store_error(&self) -> Option<&SessionStoreError>

Implementors§