pub struct SessionStore { /* private fields */ }Implementations§
Source§impl SessionStore
impl SessionStore
pub fn new(cache: BoxedCache) -> Self
Sourcepub async fn save(&self, session: &Session) -> Result<String, SessionError>
pub async fn save(&self, session: &Session) -> Result<String, SessionError>
Store session under a new ID and return it. Use this at
login, so the user gets a fresh ID. To update a session that
already exists, use Self::save_with_id.
§Errors
A cache or serialization error.
Sourcepub async fn save_with_id(
&self,
id: &str,
session: &Session,
) -> Result<(), SessionError>
pub async fn save_with_id( &self, id: &str, session: &Session, ) -> Result<(), SessionError>
Sourcepub async fn load(&self, id: &str) -> Result<Option<Session>, SessionError>
pub async fn load(&self, id: &str) -> Result<Option<Session>, SessionError>
Load a session by ID. Missing, expired and unreadable entries
all give Ok(None).
§Errors
A cache error. A value that fails to parse gives Ok(None)
instead, so a stored-format change does not 500 every request.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SessionStore
impl !UnwindSafe for SessionStore
impl Freeze for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more