Enum tower_sessions::Expiry
source ยท pub enum Expiry {
OnSessionEnd,
OnInactivity(Duration),
AtDateTime(OffsetDateTime),
}Expand description
Session expiry configuration.
ยงExamples
use time::{Duration, OffsetDateTime};
use tower_sessions::Expiry;
// Will be expired on "session end".
let expiry = Expiry::OnSessionEnd;
// Will be expired in five minutes from last acitve.
let expiry = Expiry::OnInactivity(Duration::minutes(5));
// Will be expired at the given timestamp.
let expired_at = OffsetDateTime::now_utc().saturating_add(Duration::weeks(2));
let expiry = Expiry::AtDateTime(expired_at);Variantsยง
OnSessionEnd
Expire on current session end, as defined by the browser.
OnInactivity(Duration)
Expire on inactivity.
Reading a session is not considered activity for expiration purposes.
Session expiration is computed from the last time the session was
modified.
AtDateTime(OffsetDateTime)
Expire at a specific date and time.
This value may be extended manually with
set_expiry.
Trait Implementationsยง
sourceยงimpl<'de> Deserialize<'de> for Expiry
impl<'de> Deserialize<'de> for Expiry
sourceยงfn deserialize<__D>(
__deserializer: __D,
) -> Result<Expiry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Expiry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceยงimpl Serialize for Expiry
impl Serialize for Expiry
sourceยงfn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Expiry
impl Eq for Expiry
impl StructuralPartialEq for Expiry
Auto Trait Implementationsยง
impl Freeze for Expiry
impl RefUnwindSafe for Expiry
impl Send for Expiry
impl Sync for Expiry
impl Unpin for Expiry
impl UnwindSafe for Expiry
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,
sourceยงunsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
๐ฌThis is a nightly-only experimental API. (
clone_to_uninit)