pub struct CookieSession { /* private fields */ }Expand description
Opens and commits sessions using a store plus a session-id cookie.
Implementations§
Source§impl CookieSession
impl CookieSession
Sourcepub fn new(store: Arc<dyn SessionStore>) -> CookieSession
pub fn new(store: Arc<dyn SessionStore>) -> CookieSession
Binds store with default cookie options.
Sourcepub fn with_options(
store: Arc<dyn SessionStore>,
options: CookieSessionOptions,
) -> CookieSession
pub fn with_options( store: Arc<dyn SessionStore>, options: CookieSessionOptions, ) -> CookieSession
Binds store with custom cookie options.
Sourcepub const fn options(&self) -> &CookieSessionOptions
pub const fn options(&self) -> &CookieSessionOptions
Cookie options.
Sourcepub fn open(&self, cookie_header: Option<&str>) -> Result<Session, SessionError>
pub fn open(&self, cookie_header: Option<&str>) -> Result<Session, SessionError>
Loads or creates a session from an optional raw Cookie request header.
§Errors
Returns SessionError when id generation or the store fails.
Sourcepub fn commit(&self, session: &Session) -> Result<Option<String>, SessionError>
pub fn commit(&self, session: &Session) -> Result<Option<String>, SessionError>
Persists session and returns a Set-Cookie header value when needed.
Returns None when the session was neither new, dirty, nor invalidated.
§Errors
Returns SessionError when the store fails.
Trait Implementations§
Source§impl Clone for CookieSession
impl Clone for CookieSession
Source§fn clone(&self) -> CookieSession
fn clone(&self) -> CookieSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CookieSession
impl !UnwindSafe for CookieSession
impl Forget for CookieSession
impl Freeze for CookieSession
impl Move for CookieSession
impl Send for CookieSession
impl Sync for CookieSession
impl Unpin for CookieSession
impl UnsafeUnpin for CookieSession
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
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.