Skip to main content

TtlCell

Struct TtlCell 

Source
pub struct TtlCell<T> { /* private fields */ }

Implementations§

Source§

impl<T> TtlCell<T>

Source

pub fn new(ttl: Duration) -> Self

Source

pub fn new_with_value(ttl: Duration, value: T) -> Self

Source

pub fn replace(&mut self, value: T) -> Option<T>

Source

pub fn set(&mut self, value: T)

Source

pub fn clear(&mut self)

Source

pub fn as_ref(&self) -> Option<&T>

Source

pub fn as_ref_with<'a, O>( &'a self, other: &'a TtlCell<O>, max_time_delta: Duration, ) -> Option<(&T, &O)>

Source

pub fn take(&mut self) -> Option<T>

Source

pub fn take_with<O>( &mut self, other: &mut TtlCell<O>, max_time_delta: Duration, ) -> Option<(T, O)>

Source

pub fn as_deref(&self) -> Option<&T::Target>
where T: Deref,

Source

pub fn expired(&self) -> bool

Source

pub fn touch(&mut self)

Source

pub fn set_at(&self) -> Monotonic

Auto Trait Implementations§

§

impl<T> Freeze for TtlCell<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TtlCell<T>
where T: RefUnwindSafe,

§

impl<T> Send for TtlCell<T>
where T: Send,

§

impl<T> Sync for TtlCell<T>
where T: Sync,

§

impl<T> Unpin for TtlCell<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for TtlCell<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for TtlCell<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.