Struct freya::prelude::SetCompare
pub struct SetCompare<R, S = UnsyncStorage>{ /* private fields */ }Expand description
An object that can efficiently compare a value to a set of values.
Implementations§
§impl<R> SetCompare<R>
impl<R> SetCompare<R>
pub 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.
§impl<R, S> SetCompare<R, S>
impl<R, S> SetCompare<R, S>
pub 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.
pub 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§
§impl<R, S> Clone for SetCompare<R, S>
impl<R, S> Clone for SetCompare<R, S>
§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§impl<R, S> Debug for SetCompare<R, S>
impl<R, S> Debug for SetCompare<R, S>
§impl<R, S> PartialEq for SetCompare<R, S>
impl<R, S> PartialEq for SetCompare<R, S>
§fn eq(&self, other: &SetCompare<R, S>) -> bool
fn eq(&self, other: &SetCompare<R, S>) -> bool
self and other values to be equal, and is used
by ==.impl<R, S> Copy for SetCompare<R, S>
Auto Trait Implementations§
impl<R, S> Freeze for SetCompare<R, S>
impl<R, S = UnsyncStorage> !RefUnwindSafe for SetCompare<R, S>
impl<R, S = UnsyncStorage> !Send for SetCompare<R, S>
impl<R, S = UnsyncStorage> !Sync for SetCompare<R, S>
impl<R, S> Unpin for SetCompare<R, S>where
R: Unpin,
impl<R, S = UnsyncStorage> !UnwindSafe for SetCompare<R, S>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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