Memo

Struct Memo 

Source
pub struct Memo<T: PartialEq + 'static> { /* private fields */ }
Expand description

A memoized derived value that only recomputes when one of its tracked dependencies changes, and only notifies dependents when its value changes.

Unlike the previous implementation, this is driven by dependency invalidation rather than an Effect that eagerly recomputes.

Implementations§

Source§

impl<T: PartialEq + 'static> Memo<T>

Source

pub fn new(f: impl Fn(Option<&T>) -> T + 'static) -> Self

Trait Implementations§

Source§

impl<T: Add<Output = T> + 'static + PartialEq> Add<T> for Memo<T>
where for<'a> &'a T: Add<T, Output = T>,

Source§

type Output = T

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: BitAnd<Output = T> + 'static + PartialEq> BitAnd<T> for Memo<T>
where for<'a> &'a T: BitAnd<T, Output = T>,

Source§

type Output = T

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: BitOr<Output = T> + 'static + PartialEq> BitOr<T> for Memo<T>
where for<'a> &'a T: BitOr<T, Output = T>,

Source§

type Output = T

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: BitXor<Output = T> + 'static + PartialEq> BitXor<T> for Memo<T>
where for<'a> &'a T: BitXor<T, Output = T>,

Source§

type Output = T

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: PartialEq + 'static> Clone for Memo<T>

Source§

fn clone(&self) -> Self

Returns a duplicate 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: Display + 'static + PartialEq> Display for Memo<T>

Source§

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

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

impl<T: Div<Output = T> + 'static + PartialEq> Div<T> for Memo<T>
where for<'a> &'a T: Div<T, Output = T>,

Source§

type Output = T

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Mul<Output = T> + 'static + PartialEq> Mul<T> for Memo<T>
where for<'a> &'a T: Mul<T, Output = T>,

Source§

type Output = T

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: 'static + PartialEq> Neg for Memo<T>
where for<'a> &'a T: Neg<Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: 'static + PartialEq> Not for Memo<T>
where for<'a> &'a T: Not<Output = T>,

Source§

type Output = T

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: PartialEq + 'static> PartialEq<T> for Memo<T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Rem<Output = T> + 'static + PartialEq> Rem<T> for Memo<T>
where for<'a> &'a T: Rem<T, Output = T>,

Source§

type Output = T

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Shl<Output = T> + 'static + PartialEq> Shl<T> for Memo<T>
where for<'a> &'a T: Shl<T, Output = T>,

Source§

type Output = T

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T: Shr<Output = T> + 'static + PartialEq> Shr<T> for Memo<T>
where for<'a> &'a T: Shr<T, Output = T>,

Source§

type Output = T

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T: Clone + PartialEq + 'static> SignalGet<T> for Memo<T>
where ReadSignal<T>: SignalGet<T>,

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn get_untracked(&self) -> T
where T: 'static,

Source§

fn get(&self) -> T
where T: 'static,

Source§

fn try_get(&self) -> Option<T>
where T: 'static,

Source§

fn try_get_untracked(&self) -> Option<T>
where T: 'static,

Source§

impl<T: PartialEq + 'static> SignalTrack<T> for Memo<T>

Source§

fn id(&self) -> Id

Source§

fn track(&self)

Only subscribes to the current running effect to this Signal.
Source§

fn try_track(&self)

If the signal isn’t disposed,
Source§

impl<T: PartialEq + 'static> SignalWith<T> for Memo<T>
where ReadSignal<T>: SignalWith<T>,

Source§

fn id(&self) -> Id

get the Signal Id
Source§

fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Source§

fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Source§

fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

Source§

fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

Source§

impl<T: Sub<Output = T> + 'static + PartialEq> Sub<T> for Memo<T>
where for<'a> &'a T: Sub<T, Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: PartialEq + 'static> Copy for Memo<T>

Auto Trait Implementations§

§

impl<T> Freeze for Memo<T>

§

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

§

impl<T> !Send for Memo<T>

§

impl<T> !Sync for Memo<T>

§

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

§

impl<T> UnwindSafe for Memo<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.