Enum rustfst::algorithms::lazy::cache::cache_status::CacheStatus
source · pub enum CacheStatus<T> {
NotComputed,
Computed(T),
}
Expand description
This enumeration represents the computation status in a cache.
Variants§
Implementations§
source§impl<T> CacheStatus<T>
impl<T> CacheStatus<T>
sourcepub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> CacheStatus<U>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> CacheStatus<U>
Map the computed value and returned it as a cache status.
sourcepub fn and<U>(self, other: CacheStatus<U>) -> CacheStatus<U>
pub fn and<U>(self, other: CacheStatus<U>) -> CacheStatus<U>
Returns NotComputed
if self is not computed otherwise it returns other.
sourcepub fn and_then<U>(self, f: impl FnOnce(T) -> CacheStatus<U>) -> CacheStatus<U>
pub fn and_then<U>(self, f: impl FnOnce(T) -> CacheStatus<U>) -> CacheStatus<U>
Chain lazyly two CacheStatus
and flatten them.
sourcepub fn into_option(self) -> Option<T>
pub fn into_option(self) -> Option<T>
Convert into an Option
. Some
if computed otherwise None
.
sourcepub fn is_computed(&self) -> bool
pub fn is_computed(&self) -> bool
Return true if CachStatus
is computed.
sourcepub fn is_not_computed(&self) -> bool
pub fn is_not_computed(&self) -> bool
Return true if CachStatus
is not computed.
sourcepub fn or(self, other: CacheStatus<T>) -> CacheStatus<T>
pub fn or(self, other: CacheStatus<T>) -> CacheStatus<T>
If the value is already computed, self is returned otherwise other
is returned.
If a lazy implementation is preferable, call or_else
.
pub fn or_else(self, f: impl FnOnce() -> CacheStatus<T>) -> CacheStatus<T>
Trait Implementations§
source§impl<T: Clone> Clone for CacheStatus<T>
impl<T: Clone> Clone for CacheStatus<T>
source§fn clone(&self) -> CacheStatus<T>
fn clone(&self) -> CacheStatus<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for CacheStatus<T>
impl<T: Debug> Debug for CacheStatus<T>
source§impl<T> From<Option<T>> for CacheStatus<T>
impl<T> From<Option<T>> for CacheStatus<T>
source§impl<T: Eq> PartialEq for CacheStatus<T>
impl<T: Eq> PartialEq for CacheStatus<T>
impl<T: Copy> Copy for CacheStatus<T>
Auto Trait Implementations§
impl<T> Freeze for CacheStatus<T>where
T: Freeze,
impl<T> RefUnwindSafe for CacheStatus<T>where
T: RefUnwindSafe,
impl<T> Send for CacheStatus<T>where
T: Send,
impl<T> Sync for CacheStatus<T>where
T: Sync,
impl<T> Unpin for CacheStatus<T>where
T: Unpin,
impl<T> UnwindSafe for CacheStatus<T>where
T: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more