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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.