pub enum Ttl {
Never,
ExpiresAt(TimestampMillis),
DurationMillis(u64),
}Variants§
Implementations§
Source§impl Ttl
impl Ttl
Sourcepub fn expires_at(&self, anchor: TimestampMillis) -> Option<TimestampMillis>
pub fn expires_at(&self, anchor: TimestampMillis) -> Option<TimestampMillis>
The absolute instant at which this TTL elapses, anchored at anchor, if ever.
Never has no expiry. A DurationMillis whose anchor + duration is not
representable in i64 milliseconds (durations beyond ~292 million years)
returns None and is therefore treated as non-expiring — a deliberate,
fail-open choice for an unreachable boundary.
pub fn is_expired_at( &self, anchor: TimestampMillis, now: TimestampMillis, ) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ttl
impl<'de> Deserialize<'de> for Ttl
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 Eq for Ttl
impl StructuralPartialEq for Ttl
Auto Trait Implementations§
impl Freeze for Ttl
impl RefUnwindSafe for Ttl
impl Send for Ttl
impl Sync for Ttl
impl Unpin for Ttl
impl UnsafeUnpin for Ttl
impl UnwindSafe for Ttl
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