Trait TtlBackend

Source
pub trait TtlBackend: Clone {
    type Duration;

    // Required methods
    fn now() -> Self;
    fn expired() -> Self;
    fn add(self, dt: Self::Duration) -> Self;
    fn is_valid(&self) -> bool;
    fn is_expired(&self) -> bool;
}

Required Associated Types§

Required Methods§

Source

fn now() -> Self

Source

fn expired() -> Self

Source

fn add(self, dt: Self::Duration) -> Self

Source

fn is_valid(&self) -> bool

Source

fn is_expired(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TtlBackend for Instant

Source§

type Duration = Duration

Source§

fn now() -> Self

Source§

fn expired() -> Self

Source§

fn add(self, dt: Self::Duration) -> Self

Source§

fn is_valid(&self) -> bool

Source§

fn is_expired(&self) -> bool

Source§

impl TtlBackend for DateTime<Utc>

Source§

type Duration = TimeDelta

Source§

fn now() -> Self

Source§

fn expired() -> Self

Source§

fn add(self, dt: Self::Duration) -> Self

Source§

fn is_valid(&self) -> bool

Source§

fn is_expired(&self) -> bool

Implementors§