pub struct RxHashMapNestedRx<K, V>(_)
where
         K: Clone + Serialize + DeserializeOwned + Eq + Hash,
         V: MakeRx + Serialize + DeserializeOwned + 'static,
         V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone;
Expand description

The reactive version of RxHashMapNested.

Methods from Deref<Target = Signal<T>>§

pub fn set(&self, value: T)

Set the current value of the state.

This will notify and update any effects and memos that depend on this value.

Example
let state = create_signal(cx, 0);
assert_eq!(*state.get(), 0);

state.set(1);
assert_eq!(*state.get(), 1);

pub fn set_rc(&self, value: Rc<T>)

Set the current value of the state wrapped in a Rc. Unlike [Signal::set()], this method accepts the value wrapped in a Rc because the underlying storage is already using Rc, thus preventing an unnecessary clone.

This will notify and update any effects and memos that depend on this value.

Example
let state = create_signal(cx, 0);
assert_eq!(*state.get(), 0);

state.set_rc(Rc::new(1));
assert_eq!(*state.get(), 1);

pub fn set_silent(&self, value: T)

Set the current value of the state without triggering subscribers.

Make sure you know what you are doing because this can make state inconsistent.

pub fn set_rc_silent(&self, value: Rc<T>)

Set the current value of the state wrapped in a Rc without triggering subscribers.

See the documentation for [Signal::set_rc()] for more information.

Make sure you know what you are doing because this can make state inconsistent.

pub fn split(&self) -> (impl Fn() + Copy, impl Fn(T) + Copy)

Split a signal into getter and setter handles.

Example
let (state, set_state) = create_signal(cx, 0).split();
assert_eq!(*state(), 0);

set_state(1);
assert_eq!(*state(), 1);

pub fn trigger_subscribers(&self)

Calls all the subscribers without modifying the state. This can be useful when using patterns such as inner mutability where the state updated will not be automatically triggered. In the general case, however, it is preferable to use [Signal::set()] instead.

This will also re-compute all the subscribers of this signal by calling all the dependency callbacks.

pub fn modify(&self) -> Modify<'_, T>

Return a mutable handle to make it easier to mutate the inner value. This requires the inner type to implement Clone.

Example
let state = create_signal(cx, "Hello ".to_string());
state.modify().push_str("World!");
assert_eq!(*state.get(), "Hello World!");

pub fn take(&self) -> Rc<T>

Take the current value out and replace it with the default value.

This will notify and update any effects and memos that depend on this value.

pub fn take_silent(&self) -> Rc<T>

Take the current value out and replace it with the default value without triggering subscribers.

Make sure you know what you are doing because this can make state inconsistent.

Methods from Deref<Target = ReadSignal<T>>§

pub fn get(&self) -> Rc<T>

Get the current value of the state. When called inside a reactive scope, calling this will add itself to the scope’s dependencies.

Example
let state = create_signal(cx, 0);
assert_eq!(*state.get(), 0);

state.set(1);
assert_eq!(*state.get(), 1);

pub fn get_untracked(&self) -> Rc<T>

Get the current value of the state, without tracking this as a dependency if inside a reactive context.

Example
let state = create_signal(cx, 1);
let double = create_memo(cx, || *state.get_untracked() * 2);
assert_eq!(*double.get(), 2);

state.set(2);
// double value should still be old value because state was untracked
assert_eq!(*double.get(), 2);

pub fn map<'a, U>( &'a self, cx: BoundedScope<'a, 'a>, f: impl FnMut(&T) -> U + 'a ) -> &'a ReadSignal<U>

Creates a mapped [ReadSignal]. This is equivalent to using [create_memo].

Example
let state = create_signal(cx, 1);
let double = state.map(cx, |&x| x * 2);
assert_eq!(*double.get(), 2);

state.set(2);
assert_eq!(*double.get(), 4);

pub fn track(&self)

When called inside a reactive scope, calling this will add itself to the scope’s dependencies.

To both track and get the value of the signal, use [ReadSignal::get] instead.

Trait Implementations§

source§

impl<K, V> Clone for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash + Clone, V: MakeRx + Serialize + DeserializeOwned + 'static + Clone, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone + Clone,

source§

fn clone(&self) -> RxHashMapNestedRx<K, V>

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<K, V> Debug for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash + Debug, V: MakeRx + Serialize + DeserializeOwned + 'static + Debug, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone + Debug,

source§

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

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

impl<K, V> Deref for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash, V: MakeRx + Serialize + DeserializeOwned + 'static, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone,

§

type Target = RcSignal<HashMap<K, <V as MakeRx>::Rx, RandomState>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<K, V> Freeze for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash, V: MakeRx + Serialize + DeserializeOwned + 'static, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone,

source§

fn freeze(&self) -> String

‘Freezes’ the reactive struct by making it unreactive and converting it to a String.
source§

impl<K, V> MakeUnrx for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash, V: MakeRx + Serialize + DeserializeOwned + 'static, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone,

§

type Unrx = RxHashMapNested<K, V>

The type of the unreactive version that we’ll convert to.
source§

fn make_unrx(self) -> Self::Unrx

Transforms an instance of the struct into its unreactive version. By having this as an associated type, we can associate the reactive type with the unreactive, meaning greater inference and fewer arguments that the user needs to provide to macros.
source§

fn compute_suspense(&self, cx: Scope<'_>)

Calls all handlers on suspended state, spawning scoped futures for each of them (the futures must be scoped to prevent the same handler being run multiple times concurrently if a user leaves the page and then comes back). Read more
source§

impl<K, V> PartialEq<RxHashMapNestedRx<K, V>> for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash + PartialEq, V: MakeRx + Serialize + DeserializeOwned + 'static + PartialEq, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone + PartialEq,

source§

fn eq(&self, other: &RxHashMapNestedRx<K, V>) -> 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<K, V> Eq for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash + Eq, V: MakeRx + Serialize + DeserializeOwned + 'static + Eq, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone + Eq,

source§

impl<K, V> StructuralEq for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash, V: MakeRx + Serialize + DeserializeOwned + 'static, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone,

source§

impl<K, V> StructuralPartialEq for RxHashMapNestedRx<K, V>where K: Clone + Serialize + DeserializeOwned + Eq + Hash, V: MakeRx + Serialize + DeserializeOwned + 'static, V::Rx: MakeUnrx<Unrx = V> + Freeze + Clone,

Auto Trait Implementations§

§

impl<K, V> !RefUnwindSafe for RxHashMapNestedRx<K, V>

§

impl<K, V> !Send for RxHashMapNestedRx<K, V>

§

impl<K, V> !Sync for RxHashMapNestedRx<K, V>

§

impl<K, V> Unpin for RxHashMapNestedRx<K, V>

§

impl<K, V> !UnwindSafe for RxHashMapNestedRx<K, V>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AnyFreeze for Twhere T: Any + Freeze,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Gives &dyn Any to enable downcasting.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.