Trait tsukuyomi_session::RawSession
source · pub trait RawSession {
type WriteError: Into<Error>;
type WriteSession: TryFuture<Ok = (), Error = Self::WriteError>;
fn get(&self, name: &str) -> Option<&str>;
fn set(&mut self, name: &str, value: String);
fn remove(&mut self, name: &str);
fn clear(&mut self);
fn write(self) -> Self::WriteSession;
}
Expand description
A trait that abstracts the management of session data during request handling.
Required Associated Types§
sourcetype WriteError: Into<Error>
type WriteError: Into<Error>
The error type during writing modification to the backend.
sourcetype WriteSession: TryFuture<Ok = (), Error = Self::WriteError>
type WriteSession: TryFuture<Ok = (), Error = Self::WriteError>
A TryFuture
to write the modification of session data.
Required Methods§
sourcefn get(&self, name: &str) -> Option<&str>
fn get(&self, name: &str) -> Option<&str>
Returns the value of session data with the specified key name, if exists.
sourcefn set(&mut self, name: &str, value: String)
fn set(&mut self, name: &str, value: String)
Appends a value to session data with the specified key name.
sourcefn remove(&mut self, name: &str)
fn remove(&mut self, name: &str)
Removes the value with the specified key name from session data.
sourcefn write(self) -> Self::WriteSession
fn write(self) -> Self::WriteSession
Consumes itself and creates a TryFuture
to write the modification of session data.