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§

§

NotComputed

§

Computed(T)

Implementations§

source§

impl<T> CacheStatus<T>

source

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> CacheStatus<U>

Map the computed value and returned it as a cache status.

source

pub fn and<U>(self, other: CacheStatus<U>) -> CacheStatus<U>

Returns NotComputed if self is not computed otherwise it returns other.

source

pub fn and_then<U>(self, f: impl FnOnce(T) -> CacheStatus<U>) -> CacheStatus<U>

Chain lazyly two CacheStatus and flatten them.

source

pub fn into_option(self) -> Option<T>

Convert into an Option. Some if computed otherwise None.

source

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

Convert to an Option. Some if computed otherwise None.

source

pub fn is_computed(&self) -> bool

Return true if CachStatus is computed.

source

pub fn is_not_computed(&self) -> bool

Return true if CachStatus is not computed.

source

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.

source

pub fn or_else(self, f: impl FnOnce() -> CacheStatus<T>) -> CacheStatus<T>

Trait Implementations§

source§

impl<T: Clone> Clone for CacheStatus<T>

source§

fn clone(&self) -> CacheStatus<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for CacheStatus<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> From<Option<T>> for CacheStatus<T>

source§

fn from(v: Option<T>) -> Self

Converts to this type from the input type.
source§

impl<T: Eq> PartialEq for CacheStatus<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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> 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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V