pub struct SetCompare<R, S = UnsyncStorage>{ /* private fields */ }
Expand description
An object that can efficiently compare a value to a set of values.
Implementations§
Source§impl<R> SetCompare<R>
impl<R> SetCompare<R>
Sourcepub fn new(f: impl FnMut() -> R + 'static) -> SetCompare<R>
pub fn new(f: impl FnMut() -> R + 'static) -> SetCompare<R>
Creates a new SetCompare
which efficiently tracks when a value changes to check if it is equal to a set of values.
Generally, you shouldn’t need to use this hook. Instead you can use [crate::use_memo
]. If you have many values that you need to compare to a single value, this hook will change updates from O(n) to O(1) where n is the number of values you are comparing to.
Source§impl<R, S> SetCompare<R, S>
impl<R, S> SetCompare<R, S>
Sourcepub fn new_maybe_sync(f: impl FnMut() -> R + 'static) -> SetCompare<R>
pub fn new_maybe_sync(f: impl FnMut() -> R + 'static) -> SetCompare<R>
Creates a new SetCompare
that may be Sync + Send
which efficiently tracks when a value changes to check if it is equal to a set of values.
Generally, you shouldn’t need to use this hook. Instead you can use [crate::use_memo
]. If you have many values that you need to compare to a single value, this hook will change updates from O(n) to O(1) where n is the number of values you are comparing to.
Sourcepub fn equal(&mut self, value: R) -> ReadOnlySignal<bool, S>
pub fn equal(&mut self, value: R) -> ReadOnlySignal<bool, S>
Returns a signal which is true when the value is equal to the value passed to this function.
Trait Implementations§
Source§impl<R, S> Clone for SetCompare<R, S>
impl<R, S> Clone for SetCompare<R, S>
Source§fn clone(&self) -> SetCompare<R, S>
fn clone(&self) -> SetCompare<R, S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more