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 PartialEq for Expiry
impl PartialEq for Expiry
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 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