pub struct Store<T, Lens = WriteSignal<T>>where
T: ?Sized,{ /* private fields */ }prelude only.Expand description
Stores are a reactive type built for nested data structures. Each store will lazily create signals for each field/member of the data structure as needed.
By default stores act a lot like dioxus_signals::Signals, but they provide more granular
subscriptions without requiring nested signals. You should derive Store on your data
structures to generate selectors that let you scope the store to a specific part of your data.
You can also use the #[store] macro on an impl block to add any additional methods to your store
with an extension trait. This lets you add methods to the store even though the type is not defined in your crate.
§Example
use dioxus::prelude::*;
use dioxus_stores::*;
fn main() {
dioxus::launch(app);
}
// Deriving the store trait provides methods to scope the store to specific parts of your data structure.
// The `Store` macro generates a `count` and `children` method for the `CounterTree` struct.
#[derive(Store, Default)]
struct CounterTree {
count: i32,
children: Vec<CounterTree>,
}
// The store macro generates an extension trait with additional methods for the store based on the impl block.
#[store]
impl<Lens> Store<CounterTree, Lens> {
// Methods that take &self automatically require the lens to implement `Readable` which lets you read the store.
fn sum(&self) -> i32 {
self.count().cloned() + self.children().iter().map(|c| c.sum()).sum::<i32>()
}
}
fn app() -> Element {
let value = use_store(Default::default);
rsx! {
Tree {
value
}
}
}
#[component]
fn Tree(value: Store<CounterTree>) -> Element {
// Calling the generated `count` method returns a new store that can only
// read and write the count field
let mut count = value.count();
let mut children = value.children();
rsx! {
button {
// Incrementing the count will only rerun parts of the app that have read the count field
onclick: move |_| count += 1,
"Increment"
}
button {
// Stores are aware of data structures like `Vec` and `Hashmap`. When we push an item to the vec
// it will only rerun the parts of the app that depend on the length of the vec
onclick: move |_| children.push(Default::default()),
"Push child"
}
"sum: {value.sum()}"
ul {
// Iterating over the children gives us stores scoped to each child.
for value in children.iter() {
li {
Tree { value }
}
}
}
}
}Implementations§
Source§impl<Lens, K, V> Store<BTreeMap<K, V>, Lens>
impl<Lens, K, V> Store<BTreeMap<K, V>, Lens>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the BTreeMap. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
assert_eq!(store.len(), 0);
store.insert(0, "value".to_string());
assert_eq!(store.len(), 1);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the BTreeMap is empty. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
assert!(store.is_empty());
store.insert(0, "value".to_string());
assert!(!store.is_empty());Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
pub fn iter( &self, ) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
Iterate over the current entries in the BTreeMap, returning a tuple of the key and a store for the value. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(0, "value1".to_string());
store.insert(1, "value2".to_string());
for (key, value_store) in store.iter() {
println!("{}: {}", key, value_store.read());
}Sourcepub fn values(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
pub fn values( &self, ) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
Get an iterator over the values in the BTreeMap. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(0, "value1".to_string());
store.insert(1, "value2".to_string());
for value_store in store.values() {
println!("{}", value_store.read());
}Sourcepub fn insert(&mut self, key: K, value: V)
pub fn insert(&mut self, key: K, value: V)
Insert a new key-value pair into the BTreeMap. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
assert!(store.get(0).is_none());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());Sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Remove a key-value pair from the BTreeMap. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map or the value of the removed key.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());
let removed_value = store.remove(&0);
assert_eq!(removed_value, Some("value".to_string()));
assert!(store.get(0).is_none());Sourcepub fn clear(&mut self)where
Lens: Writable,
pub fn clear(&mut self)where
Lens: Writable,
Clear the BTreeMap, removing all key-value pairs. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(1, "value1".to_string());
store.insert(2, "value2".to_string());
assert_eq!(store.len(), 2);
store.clear();
assert!(store.is_empty());Sourcepub fn retain(&mut self, f: impl FnMut(&K, &V) -> bool)
pub fn retain(&mut self, f: impl FnMut(&K, &V) -> bool)
Retain only the key-value pairs that satisfy the given predicate. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map or the values retained.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(1, "value1".to_string());
store.insert(2, "value2".to_string());
store.retain(|key, value| *key == 1);
assert_eq!(store.len(), 1);
assert!(store.get(1).is_some());
assert!(store.get(2).is_none());Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Check if the BTreeMap contains a key. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
assert!(!store.contains_key(&0));
store.insert(0, "value".to_string());
assert!(store.contains_key(&0));Sourcepub fn get<Q>(self, key: Q) -> Option<Store<V, GetWrite<Q, Lens>>>
pub fn get<Q>(self, key: Q) -> Option<Store<V, GetWrite<Q, Lens>>>
Get a store for the value associated with the given key. This method creates a new store scope that tracks just changes to the value associated with the key.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
assert!(store.get(0).is_none());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());Sourcepub fn get_unchecked<Q>(self, key: Q) -> Store<V, GetWrite<Q, Lens>>
pub fn get_unchecked<Q>(self, key: Q) -> Store<V, GetWrite<Q, Lens>>
Get a store for the value associated with the given key without checking if the key exists. This method creates a new store scope that tracks just changes to the value associated with the key.
This is not unsafe, but it will panic when you try to read the value if it does not exist.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::BTreeMap;
let mut store = use_store(|| BTreeMap::new());
store.insert(0, "value".to_string());
assert_eq!(store.get_unchecked(0).cloned(), "value".to_string());Source§impl<Lens, T> Store<T, Lens>
impl<Lens, T> Store<T, Lens>
Sourcepub fn deref(
self,
) -> Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>
pub fn deref( self, ) -> Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>
Returns a store that dereferences the original value. The dereferenced store shares the same subscriptions and tracking as the original store, but allows you to access the methods of the underlying type.
§Example
use dioxus_stores::*;
let store = use_store(|| Box::new(vec![1, 2, 3]));
let deref_store = store.deref();
// The dereferenced store can access the store methods of the underlying type.
assert_eq!(deref_store.len(), 3);Source§impl<Lens, K, V, St> Store<HashMap<K, V, St>, Lens>
impl<Lens, K, V, St> Store<HashMap<K, V, St>, Lens>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the HashMap. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
assert_eq!(store.len(), 0);
store.insert(0, "value".to_string());
assert_eq!(store.len(), 1);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the HashMap is empty. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
assert!(store.is_empty());
store.insert(0, "value".to_string());
assert!(!store.is_empty());Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
pub fn iter( &self, ) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
Iterate over the current entries in the HashMap, returning a tuple of the key and a store for the value. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(0, "value1".to_string());
store.insert(1, "value2".to_string());
for (key, value_store) in store.iter() {
println!("{}: {}", key, value_store.read());
}Sourcepub fn values(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
pub fn values( &self, ) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIterator
Get an iterator over the values in the HashMap. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(0, "value1".to_string());
store.insert(1, "value2".to_string());
for value_store in store.values() {
println!("{}", value_store.read());
}Sourcepub fn insert(&mut self, key: K, value: V)
pub fn insert(&mut self, key: K, value: V)
Insert a new key-value pair into the HashMap. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
assert!(store.get(0).is_none());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());Sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Remove a key-value pair from the HashMap. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map or the value of the removed key.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());
let removed_value = store.remove(&0);
assert_eq!(removed_value, Some("value".to_string()));
assert!(store.get(0).is_none());Sourcepub fn clear(&mut self)where
Lens: Writable,
pub fn clear(&mut self)where
Lens: Writable,
Clear the HashMap, removing all key-value pairs. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(1, "value1".to_string());
store.insert(2, "value2".to_string());
assert_eq!(store.len(), 2);
store.clear();
assert!(store.is_empty());Sourcepub fn retain(&mut self, f: impl FnMut(&K, &V) -> bool)where
Lens: Writable,
pub fn retain(&mut self, f: impl FnMut(&K, &V) -> bool)where
Lens: Writable,
Retain only the key-value pairs that satisfy the given predicate. This method will mark the store as shallowly dirty, causing re-runs of any reactive scopes that depend on the shape of the map or the values retained.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(1, "value1".to_string());
store.insert(2, "value2".to_string());
store.retain(|key, value| *key == 1);
assert_eq!(store.len(), 1);
assert!(store.get(1).is_some());
assert!(store.get(2).is_none());Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Check if the HashMap contains a key. This method will track the store shallowly and only cause re-runs when items are added or removed from the map, not when existing values are modified.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
assert!(!store.contains_key(&0));
store.insert(0, "value".to_string());
assert!(store.contains_key(&0));Sourcepub fn get<Q>(self, key: Q) -> Option<Store<V, GetWrite<Q, Lens>>>
pub fn get<Q>(self, key: Q) -> Option<Store<V, GetWrite<Q, Lens>>>
Get a store for the value associated with the given key. This method creates a new store scope that tracks just changes to the value associated with the key.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
assert!(store.get(0).is_none());
store.insert(0, "value".to_string());
assert_eq!(store.get(0).unwrap().cloned(), "value".to_string());Sourcepub fn get_unchecked<Q>(self, key: Q) -> Store<V, GetWrite<Q, Lens>>
pub fn get_unchecked<Q>(self, key: Q) -> Store<V, GetWrite<Q, Lens>>
Get a store for the value associated with the given key without checking if the key exists. This method creates a new store scope that tracks just changes to the value associated with the key.
This is not unsafe, but it will panic when you try to read the value if it does not exist.
§Example
use dioxus_stores::*;
use dioxus::prelude::*;
use std::collections::HashMap;
let mut store = use_store(|| HashMap::new());
store.insert(0, "value".to_string());
assert_eq!(store.get_unchecked(0).cloned(), "value".to_string());Source§impl<Lens, T> Store<T, Lens>
impl<Lens, T> Store<T, Lens>
Sourcepub fn index<Idx>(
self,
index: Idx,
) -> Store<<T as Index<Idx>>::Output, IndexWrite<Idx, Lens>>
pub fn index<Idx>( self, index: Idx, ) -> Store<<T as Index<Idx>>::Output, IndexWrite<Idx, Lens>>
Index into the store, returning a store that allows access to the item at the given index. The new store will only update when the item at the index changes.
§Example
use dioxus_stores::*;
let store = use_store(|| vec![1, 2, 3]);
let indexed_store = store.index(1);
// The indexed store can access the store methods of the indexed store.
assert_eq!(indexed_store(), 2);Source§impl<Lens, T> Store<Option<T>, Lens>
impl<Lens, T> Store<Option<T>, Lens>
Sourcepub fn is_some(&self) -> bool
pub fn is_some(&self) -> bool
Checks if the Option is Some. This will only track the shallow state of the Option. It will
only cause a re-run if the Option could change from None to Some or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
assert!(store.is_some());Sourcepub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool
pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool
Returns true if the option is Some and the closure returns true. This will always track the shallow state of the and will track the inner state of the enum if the enum is Some.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
assert!(store.is_some_and(|v| *v == 42));Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Checks if the Option is None. This will only track the shallow state of the Option. It will
only cause a re-run if the Option could change from Some to None or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| None::<i32>);
assert!(store.is_none());Sourcepub fn is_none_or(&self, f: impl FnOnce(&T) -> bool) -> bool
pub fn is_none_or(&self, f: impl FnOnce(&T) -> bool) -> bool
Returns true if the option is None or the closure returns true. This will always track the shallow state of the and will track the inner state of the enum if the enum is Some.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
assert!(store.is_none_or(|v| *v == 42));Sourcepub fn transpose(
self,
) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
pub fn transpose( self, ) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
Transpose the Store<Option<T>> into a Option<Store<T>>. This will only track the shallow state of the Option. It will
only cause a re-run if the Option could change from None to Some or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
let transposed = store.transpose();
match transposed {
Some(inner_store) => assert_eq!(inner_store(), 42),
None => panic!("Expected Some"),
}Sourcepub fn unwrap(
self,
) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
pub fn unwrap( self, ) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
Unwraps the Option and returns a Store<T>. This will only track the shallow state of the Option. It will
only cause a re-run if the Option could change from None to Some or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
let unwrapped = store.unwrap();
assert_eq!(unwrapped(), 42);Sourcepub fn expect(
self,
msg: &str,
) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
pub fn expect( self, msg: &str, ) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
Expects the Option to be Some and returns a Store<T>. If the value is None, this will panic with msg. This will
only track the shallow state of the Option. It will only cause a re-run if the Option could change from None
to Some or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
let unwrapped = store.expect("the answer to life the universe and everything");
assert_eq!(unwrapped(), 42);Sourcepub fn as_slice(
self,
) -> Store<[T], MappedMutSignal<[T], Lens, fn(&<Lens as Readable>::Target) -> &[T], fn(&mut <Lens as Readable>::Target) -> &mut [T]>>
pub fn as_slice( self, ) -> Store<[T], MappedMutSignal<[T], Lens, fn(&<Lens as Readable>::Target) -> &[T], fn(&mut <Lens as Readable>::Target) -> &mut [T]>>
Returns a slice of the contained value, or an empty slice. This will not subscribe to any part of the store.
§Example
use dioxus::prelude::*;
use dioxus_stores::*;
let store = use_store(|| Some(42));
let slice = store.as_slice();
assert_eq!(&*slice.read(), [42]);Sourcepub fn as_deref(
self,
) -> Option<Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>>where
T: DerefMut,
pub fn as_deref(
self,
) -> Option<Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>>where
T: DerefMut,
Transpose the store then coerce the contents of the Option with deref. This will only track the shallow state of the Option. It will
only cause a re-run if the Option could change from None to Some or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(Box::new(42)));
let derefed = store.as_deref().unwrap();
assert_eq!(derefed(), 42);Sourcepub fn filter(
self,
f: impl FnOnce(&T) -> bool,
) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
pub fn filter( self, f: impl FnOnce(&T) -> bool, ) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
Transpose the store then filter the contents of the Option with a closure. This will always track the shallow state of the and will track the inner state of the enum if the enum is Some.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42));
let option = store.filter(|&v| v > 40);
let value = option.unwrap();
assert_eq!(value(), 42);Sourcepub fn inspect(self, f: impl FnOnce(&T)) -> Store<Option<T>, Lens>
pub fn inspect(self, f: impl FnOnce(&T)) -> Store<Option<T>, Lens>
Call the function with a reference to the inner value if it is Some. This will always track the shallow state of the and will track the inner state of the enum if the enum is Some.
§Example
use dioxus_stores::*;
let store = use_store(|| Some(42)).inspect(|v| println!("{v}"));Source§impl<Lens, T, E> Store<Result<T, E>, Lens>
impl<Lens, T, E> Store<Result<T, E>, Lens>
Sourcepub fn is_ok(&self) -> bool
pub fn is_ok(&self) -> bool
Checks if the Result is Ok. This will only track the shallow state of the Result. It will
only cause a re-run if the Result could change from Err to Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
assert!(store.is_ok());Sourcepub fn is_ok_and(&self, f: impl FnOnce(&T) -> bool) -> bool
pub fn is_ok_and(&self, f: impl FnOnce(&T) -> bool) -> bool
Returns true if the result is Ok and the closure returns true. This will always track the shallow state of the and will track the inner state of the enum if the enum is Ok.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
assert!(store.is_ok_and(|v| *v == 42));Sourcepub fn is_err(&self) -> bool
pub fn is_err(&self) -> bool
Checks if the Result is Err. This will only track the shallow state of the Result. It will
only cause a re-run if the Result could change from Ok to Err or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42));
assert!(store.is_err());Sourcepub fn is_err_and(&self, f: impl FnOnce(&E) -> bool) -> bool
pub fn is_err_and(&self, f: impl FnOnce(&E) -> bool) -> bool
Returns true if the result is Err and the closure returns true. This will always track the shallow state of the and will track the inner state of the enum if the enum is Err.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42));
assert!(store.is_err_and(|v| *v == 42));Sourcepub fn ok(
self,
) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
pub fn ok( self, ) -> Option<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>>
Converts Store<Result<T, E>> into Option<Store<T>>, discarding the error if present. This will
only track the shallow state of the Result. It will only cause a re-run if the Result could
change from Err to Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
match store.ok() {
Some(ok_store) => assert_eq!(ok_store(), 42),
None => panic!("Expected Ok"),
}Sourcepub fn err(
self,
) -> Option<Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
pub fn err( self, ) -> Option<Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
Converts Store<Result<T, E>> into Option<Store<E>>, discarding the success if present. This will
only track the shallow state of the Result. It will only cause a re-run if the Result could
change from Ok to Err or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42));
match store.err() {
Some(err_store) => assert_eq!(err_store(), 42),
None => panic!("Expected Err"),
}Sourcepub fn transpose(
self,
) -> Result<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>, Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
pub fn transpose( self, ) -> Result<Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>, Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
Transposes the Store<Result<T, E>> into a Result<Store<T>, Store<E>>. This will only track the
shallow state of the Result. It will only cause a re-run if the Result could change from Err to
Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
match store.transpose() {
Ok(ok_store) => assert_eq!(ok_store(), 42),
Err(err_store) => assert_eq!(err_store(), ()),
}Sourcepub fn unwrap(
self,
) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
pub fn unwrap( self, ) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
Unwraps the Result and returns a Store<T>. This will only track the shallow state of the Result.
It will only cause a re-run if the Result could change from Err to Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
let unwrapped = store.unwrap();
assert_eq!(unwrapped(), 42);Sourcepub fn expect(
self,
msg: &str,
) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
pub fn expect( self, msg: &str, ) -> Store<T, MappedMutSignal<T, Lens, fn(&<Lens as Readable>::Target) -> &T, fn(&mut <Lens as Readable>::Target) -> &mut T>>
Expects the Result to be Ok and returns a Store<T>. If the value is Err, this will panic with msg.
This will only track the shallow state of the Result. It will only cause a re-run if the Result could
change from Err to Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42));
let unwrapped = store.expect("Expected Ok");
assert_eq!(unwrapped(), 42);Sourcepub fn unwrap_err(
self,
) -> Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>
pub fn unwrap_err( self, ) -> Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>
Unwraps the error variant of the Result. This will only track the shallow state of the Result.
It will only cause a re-run if the Result could change from Ok to Err or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42));
let unwrapped_err = store.unwrap_err();
assert_eq!(unwrapped_err(), 42);Sourcepub fn expect_err(
self,
msg: &str,
) -> Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>
pub fn expect_err( self, msg: &str, ) -> Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>
Expects the Result to be Err and returns a Store<E>. If the value is Ok, this will panic with msg.
This will only track the shallow state of the Result. It will only cause a re-run if the Result could
change from Ok to Err or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42));
let unwrapped_err = store.expect_err("Expected Err");
assert_eq!(unwrapped_err(), 42);Sourcepub fn inspect(self, f: impl FnOnce(&T)) -> Store<Result<T, E>, Lens>
pub fn inspect(self, f: impl FnOnce(&T)) -> Store<Result<T, E>, Lens>
Call the function with a reference to the inner value if it is Ok. This will always track the shallow state of the and will track the inner state of the enum if the enum is Ok.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<u32, ()>(42)).inspect(|v| println!("{v}"));Sourcepub fn inspect_err(self, f: impl FnOnce(&E)) -> Store<Result<T, E>, Lens>
pub fn inspect_err(self, f: impl FnOnce(&E)) -> Store<Result<T, E>, Lens>
Call the function with a mutable reference to the inner value if it is Err. This will always track the shallow
state of the Result and will track the inner state of the enum if the enum is Err.
§Example
use dioxus_stores::*;
let store = use_store(|| Err::<(), u32>(42)).inspect_err(|v| println!("{v}"));Sourcepub fn as_deref(
self,
) -> Result<Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>, Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
pub fn as_deref( self, ) -> Result<Store<<T as Deref>::Target, MappedMutSignal<<T as Deref>::Target, Lens, fn(&<Lens as Readable>::Target) -> &<T as Deref>::Target, fn(&mut <Lens as Readable>::Target) -> &mut <T as Deref>::Target>>, Store<E, MappedMutSignal<E, Lens, fn(&<Lens as Readable>::Target) -> &E, fn(&mut <Lens as Readable>::Target) -> &mut E>>>
Transpose the store then coerce the contents of the Result with deref. This will only track the shallow state of the Result. It will
only cause a re-run if the Result could change from Err to Ok or vice versa.
§Example
use dioxus_stores::*;
let store = use_store(|| Ok::<Box<u32>, ()>(Box::new(42)));
let derefed = store.as_deref().unwrap();
assert_eq!(derefed(), 42);Source§impl<Lens, I> Store<Vec<I>, Lens>
impl<Lens, I> Store<Vec<I>, Lens>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the slice. This will only track the shallow state of the slice. It will only cause a re-run if the length of the slice could change.
§Example
use dioxus_stores::*;
let store = use_store(|| vec![1, 2, 3]);
assert_eq!(store.len(), 3);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks if the slice is empty. This will only track the shallow state of the slice. It will only cause a re-run if the length of the slice could change.
§Example
use dioxus_stores::*;
let store = use_store(|| vec![1, 2, 3]);
assert!(!store.is_empty());Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIteratorwhere
Lens: Clone,
pub fn iter(
&self,
) -> impl ExactSizeIterator + DoubleEndedIterator + FusedIteratorwhere
Lens: Clone,
Returns an iterator over the items in the slice. This will only track the shallow state of the slice. It will only cause a re-run if the length of the slice could change.
§Example
use dioxus_stores::*;
let store = use_store(|| vec![1, 2, 3]);
for item in store.iter() {
println!("{}", item);
}Sourcepub fn get(&self, index: usize) -> Option<Store<I, IndexWrite<usize, Lens>>>where
Lens: Clone,
pub fn get(&self, index: usize) -> Option<Store<I, IndexWrite<usize, Lens>>>where
Lens: Clone,
Try to get an item from slice. This will only track the shallow state of the slice. It will only cause a re-run if the length of the slice could change. The new store will only update when the item at the index changes.
§Example
use dioxus_stores::*;
let store = use_store(|| vec![1, 2, 3]);
let indexed_store = store.get(1).unwrap();
// The indexed store can access the store methods of the indexed store.
assert_eq!(indexed_store(), 2);Source§impl<Lens, T> Store<Vec<T>, Lens>
impl<Lens, T> Store<Vec<T>, Lens>
Sourcepub fn push(&mut self, value: T)
pub fn push(&mut self, value: T)
Pushes an item to the end of the vector. This will only mark the length of the vector as dirty.
§Example
use dioxus_stores::*;
let mut store = use_store(|| vec![1, 2, 3]);
store.push(4);Sourcepub fn remove(&mut self, index: usize) -> T
pub fn remove(&mut self, index: usize) -> T
Removes an item from the vector at the specified index and returns it. This will mark items after the index and the length of the vector as dirty.
§Example
use dioxus_stores::*;
let mut store = use_store(|| vec![1, 2, 3]);
let removed = store.remove(1);
assert_eq!(removed, 2);Sourcepub fn insert(&mut self, index: usize, value: T)
pub fn insert(&mut self, index: usize, value: T)
Inserts an item at the specified index in the vector. This will mark items at and after the index and the length of the vector as dirty.
§Example
use dioxus_stores::*;
let mut store = use_store(|| vec![1, 2, 3]);
store.insert(1, 4);Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the vector, marking it as dirty.
§Example
use dioxus_stores::*;
let mut store = use_store(|| vec![1, 2, 3]);
store.clear();Sourcepub fn retain(&mut self, f: impl FnMut(&T) -> bool)
pub fn retain(&mut self, f: impl FnMut(&T) -> bool)
Retains only the elements specified by the predicate. This will only mark the length of the vector and items after the first removed item as dirty.
§Example
use dioxus_stores::*;
let mut store = use_store(|| vec![1, 2, 3, 4, 5]);
store.retain(|&x| x % 2 == 0);
assert_eq!(store.len(), 2);Source§impl<T, S> Store<T, CopyValue<T, S>>where
T: 'static,
S: Storage<T>,
impl<T, S> Store<T, CopyValue<T, S>>where
T: 'static,
S: Storage<T>,
Sourcepub fn new_maybe_sync(value: T) -> Store<T, CopyValue<T, S>>
pub fn new_maybe_sync(value: T) -> Store<T, CopyValue<T, S>>
Creates a new Store that might be sync. This allocates memory in the current scope, so this should only be called
inside of an initialization closure like the closure passed to use_hook.
Source§impl<T, Lens> Store<T, Lens>where
T: ?Sized,
impl<T, Lens> Store<T, Lens>where
T: ?Sized,
Sourcepub fn selector(&self) -> &SelectorScope<Lens>
pub fn selector(&self) -> &SelectorScope<Lens>
Get the underlying selector for this store. The selector provides low level access to the lazy tracking system
of the store. This can be useful to create selectors for custom data structures in libraries. For most applications
the selectors generated by the Store macro provide all the functionality you need.
Sourcepub fn into_selector(self) -> SelectorScope<Lens>
pub fn into_selector(self) -> SelectorScope<Lens>
Convert the store into the underlying selector
Trait Implementations§
Source§impl<T, Lens> AddAssign<T> for Store<T, Lens>
impl<T, Lens> AddAssign<T> for Store<T, Lens>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl<T, Lens> DivAssign<T> for Store<T, Lens>
impl<T, Lens> DivAssign<T> for Store<T, Lens>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<T, Lens> From<SelectorScope<Lens>> for Store<T, Lens>where
T: ?Sized,
impl<T, Lens> From<SelectorScope<Lens>> for Store<T, Lens>where
T: ?Sized,
Source§fn from(selector: SelectorScope<Lens>) -> Store<T, Lens>
fn from(selector: SelectorScope<Lens>) -> Store<T, Lens>
Source§impl<T, S> From<Store<T, CopyValue<T, S>>> for Store<T, ReadSignal<T, S>>where
T: 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<CopyValue<T, S>> + Storage<T>,
impl<T, S> From<Store<T, CopyValue<T, S>>> for Store<T, ReadSignal<T, S>>where
T: 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<CopyValue<T, S>> + Storage<T>,
Source§impl<T, S> From<Store<T, CopyValue<T, S>>> for Store<T, WriteSignal<T, S>>where
T: 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<CopyValue<T, S>> + Storage<T>,
impl<T, S> From<Store<T, CopyValue<T, S>>> for Store<T, WriteSignal<T, S>>where
T: 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<CopyValue<T, S>> + Storage<T>,
Source§impl<Idx, T, Write> From<Store<T, IndexWrite<Idx, Write>>> for Store<T>where
Write: Writable<Storage = UnsyncStorage> + 'static,
<Write as Writable>::WriteMetadata: 'static,
<Write as Readable>::Target: IndexMut<Idx, Output = T> + 'static,
Idx: Clone + 'static,
T: 'static,
impl<Idx, T, Write> From<Store<T, IndexWrite<Idx, Write>>> for Store<T>where
Write: Writable<Storage = UnsyncStorage> + 'static,
<Write as Writable>::WriteMetadata: 'static,
<Write as Readable>::Target: IndexMut<Idx, Output = T> + 'static,
Idx: Clone + 'static,
T: 'static,
Source§impl<Idx, T, Write> From<Store<T, IndexWrite<Idx, Write>>> for Store<T, ReadSignal<T>>
impl<Idx, T, Write> From<Store<T, IndexWrite<Idx, Write>>> for Store<T, ReadSignal<T>>
Source§fn from(value: Store<T, IndexWrite<Idx, Write>>) -> Store<T, ReadSignal<T>>
fn from(value: Store<T, IndexWrite<Idx, Write>>) -> Store<T, ReadSignal<T>>
Source§impl<__F, __FMut, T, S, Lens> From<Store<T, MappedMutSignal<T, Lens, __F, __FMut>>> for Store<T, ReadSignal<T, S>>where
Lens: Writable<Storage = S> + 'static,
__F: Fn(&<Lens as Readable>::Target) -> &T + 'static,
__FMut: Fn(&mut <Lens as Readable>::Target) -> &mut T + 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<MappedMutSignal<T, Lens, __F, __FMut>>,
T: 'static + ?Sized,
impl<__F, __FMut, T, S, Lens> From<Store<T, MappedMutSignal<T, Lens, __F, __FMut>>> for Store<T, ReadSignal<T, S>>where
Lens: Writable<Storage = S> + 'static,
__F: Fn(&<Lens as Readable>::Target) -> &T + 'static,
__FMut: Fn(&mut <Lens as Readable>::Target) -> &mut T + 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<MappedMutSignal<T, Lens, __F, __FMut>>,
T: 'static + ?Sized,
Source§fn from(
value: Store<T, MappedMutSignal<T, Lens, __F, __FMut>>,
) -> Store<T, ReadSignal<T, S>>
fn from( value: Store<T, MappedMutSignal<T, Lens, __F, __FMut>>, ) -> Store<T, ReadSignal<T, S>>
Source§impl<__F, __FMut, T, S, Lens> From<Store<T, MappedMutSignal<T, Lens, __F, __FMut>>> for Store<T, WriteSignal<T, S>>where
Lens: Writable<Storage = S> + 'static,
__F: Fn(&<Lens as Readable>::Target) -> &T + 'static,
__FMut: Fn(&mut <Lens as Readable>::Target) -> &mut T + 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<MappedMutSignal<T, Lens, __F, __FMut>>,
T: 'static + ?Sized,
impl<__F, __FMut, T, S, Lens> From<Store<T, MappedMutSignal<T, Lens, __F, __FMut>>> for Store<T, WriteSignal<T, S>>where
Lens: Writable<Storage = S> + 'static,
__F: Fn(&<Lens as Readable>::Target) -> &T + 'static,
__FMut: Fn(&mut <Lens as Readable>::Target) -> &mut T + 'static,
S: BoxedSignalStorage<T> + CreateBoxedSignalStorage<MappedMutSignal<T, Lens, __F, __FMut>>,
T: 'static + ?Sized,
Source§fn from(
value: Store<T, MappedMutSignal<T, Lens, __F, __FMut>>,
) -> Store<T, WriteSignal<T, S>>
fn from( value: Store<T, MappedMutSignal<T, Lens, __F, __FMut>>, ) -> Store<T, WriteSignal<T, S>>
Source§impl<T, S> From<Store<T, WriteSignal<T, S>>> for Store<T, ReadSignal<T, S>>
impl<T, S> From<Store<T, WriteSignal<T, S>>> for Store<T, ReadSignal<T, S>>
Source§fn from(value: Store<T, WriteSignal<T, S>>) -> Store<T, ReadSignal<T, S>>
fn from(value: Store<T, WriteSignal<T, S>>) -> Store<T, ReadSignal<T, S>>
Source§impl<Index, Write, K, V> From<Store<V, GetWrite<Index, Write>>> for Store<V>where
<Write as Writable>::WriteMetadata: 'static,
Write: Writable<Target = BTreeMap<K, V>, Storage = UnsyncStorage> + 'static,
Index: Ord + 'static,
K: Borrow<Index> + Ord + 'static,
V: 'static,
impl<Index, Write, K, V> From<Store<V, GetWrite<Index, Write>>> for Store<V>where
<Write as Writable>::WriteMetadata: 'static,
Write: Writable<Target = BTreeMap<K, V>, Storage = UnsyncStorage> + 'static,
Index: Ord + 'static,
K: Borrow<Index> + Ord + 'static,
V: 'static,
Source§impl<Index, Write, K, V, St> From<Store<V, GetWrite<Index, Write>>> for Store<V>where
<Write as Writable>::WriteMetadata: 'static,
Write: Writable<Target = HashMap<K, V, St>, Storage = UnsyncStorage> + 'static,
Index: Hash + Eq + 'static,
K: Borrow<Index> + Eq + Hash + 'static,
St: BuildHasher + 'static,
V: 'static,
impl<Index, Write, K, V, St> From<Store<V, GetWrite<Index, Write>>> for Store<V>where
<Write as Writable>::WriteMetadata: 'static,
Write: Writable<Target = HashMap<K, V, St>, Storage = UnsyncStorage> + 'static,
Index: Hash + Eq + 'static,
K: Borrow<Index> + Eq + Hash + 'static,
St: BuildHasher + 'static,
V: 'static,
Source§impl<Index, Write, K, V, St> From<Store<V, GetWrite<Index, Write>>> for Store<V, ReadSignal<V>>where
Write: Readable<Target = HashMap<K, V, St>, Storage = UnsyncStorage> + 'static,
Index: Hash + Eq + 'static,
K: Borrow<Index> + Eq + Hash + 'static,
St: BuildHasher + 'static,
V: 'static,
impl<Index, Write, K, V, St> From<Store<V, GetWrite<Index, Write>>> for Store<V, ReadSignal<V>>where
Write: Readable<Target = HashMap<K, V, St>, Storage = UnsyncStorage> + 'static,
Index: Hash + Eq + 'static,
K: Borrow<Index> + Eq + Hash + 'static,
St: BuildHasher + 'static,
V: 'static,
Source§impl<T> InitializeFromFunction<T> for Store<T>where
T: 'static,
impl<T> InitializeFromFunction<T> for Store<T>where
T: 'static,
Source§fn initialize_from_function(f: fn() -> T) -> Store<T>
fn initialize_from_function(f: fn() -> T) -> Store<T>
Source§impl<T, Lens> IntoAttributeValue for Store<T, Lens>
impl<T, Lens> IntoAttributeValue for Store<T, Lens>
Source§fn into_value(self) -> AttributeValue
fn into_value(self) -> AttributeValue
Source§impl<T, Lens> IntoDynNode for Store<T, Lens>
impl<T, Lens> IntoDynNode for Store<T, Lens>
Source§fn into_dyn_node(self) -> DynamicNode
fn into_dyn_node(self) -> DynamicNode
Source§impl<T, Lens> MulAssign<T> for Store<T, Lens>
impl<T, Lens> MulAssign<T> for Store<T, Lens>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<T, Lens> Readable for Store<T, Lens>
impl<T, Lens> Readable for Store<T, Lens>
Source§fn try_read_unchecked(
&self,
) -> Result<<<Store<T, Lens> as Readable>::Storage as AnyStorage>::Ref<'static, <Store<T, Lens> as Readable>::Target>, BorrowError>
fn try_read_unchecked( &self, ) -> Result<<<Store<T, Lens> as Readable>::Storage as AnyStorage>::Ref<'static, <Store<T, Lens> as Readable>::Target>, BorrowError>
Source§fn try_peek_unchecked(
&self,
) -> Result<<<Store<T, Lens> as Readable>::Storage as AnyStorage>::Ref<'static, <Store<T, Lens> as Readable>::Target>, BorrowError>
fn try_peek_unchecked( &self, ) -> Result<<<Store<T, Lens> as Readable>::Storage as AnyStorage>::Ref<'static, <Store<T, Lens> as Readable>::Target>, BorrowError>
Source§fn subscribers(&self) -> Subscribers
fn subscribers(&self) -> Subscribers
Source§impl<T, Lens> SubAssign<T> for Store<T, Lens>
impl<T, Lens> SubAssign<T> for Store<T, Lens>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read moreSource§impl<T, Lens> Writable for Store<T, Lens>
impl<T, Lens> Writable for Store<T, Lens>
Source§type WriteMetadata = <Lens as Writable>::WriteMetadata
type WriteMetadata = <Lens as Writable>::WriteMetadata
Source§fn try_write_unchecked(
&self,
) -> Result<WriteLock<'static, <Store<T, Lens> as Readable>::Target, <Store<T, Lens> as Readable>::Storage, <Store<T, Lens> as Writable>::WriteMetadata>, BorrowMutError>
fn try_write_unchecked( &self, ) -> Result<WriteLock<'static, <Store<T, Lens> as Readable>::Target, <Store<T, Lens> as Readable>::Storage, <Store<T, Lens> as Writable>::WriteMetadata>, BorrowMutError>
impl<T, Lens> Copy for Store<T, Lens>
Auto Trait Implementations§
impl<T, Lens> Freeze for Store<T, Lens>
impl<T, Lens = WriteSignal<T>> !RefUnwindSafe for Store<T, Lens>
impl<T, Lens> Send for Store<T, Lens>
impl<T, Lens> Sync for Store<T, Lens>
impl<T, Lens> Unpin for Store<T, Lens>
impl<T, Lens = WriteSignal<T>> !UnwindSafe for Store<T, Lens>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> ReadableBoxExt for R
impl<R> ReadableBoxExt for R
Source§impl<R> ReadableExt for R
impl<R> ReadableExt for R
Source§fn read(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
fn read(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
Source§fn try_read(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
fn try_read(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
Source§fn read_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
fn read_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
Source§fn peek(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
fn peek(&self) -> <Self::Storage as AnyStorage>::Ref<'_, Self::Target>where
Self::Target: 'static,
Source§fn try_peek(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
fn try_peek(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, Self::Target>, BorrowError>where
Self::Target: 'static,
Source§fn peek_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
fn peek_unchecked(
&self,
) -> <Self::Storage as AnyStorage>::Ref<'static, Self::Target>where
Self::Target: 'static,
Source§fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
Source§fn cloned(&self) -> Self::Target
fn cloned(&self) -> Self::Target
Source§fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> Owhere
Self::Target: 'static,
fn with<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> Owhere
Self::Target: 'static,
Source§impl<K, V, H, R> ReadableHashMapExt<K, V, H> for R
impl<K, V, H, R> ReadableHashMapExt<K, V, H> for R
Source§impl<V, H, R> ReadableHashSetExt<V, H> for R
impl<V, H, R> ReadableHashSetExt<V, H> for R
Source§impl<T, R> ReadableOptionExt<T> for R
impl<T, R> ReadableOptionExt<T> for R
Source§impl<T, E, R> ReadableResultExt<T, E> for R
impl<T, E, R> ReadableResultExt<T, E> for R
Source§fn unwrap(&self) -> Twhere
T: Clone + 'static,
E: 'static,
fn unwrap(&self) -> Twhere
T: Clone + 'static,
E: 'static,
Source§fn as_ref(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, T>, <Self::Storage as AnyStorage>::Ref<'_, E>>where
T: 'static,
E: 'static,
fn as_ref(
&self,
) -> Result<<Self::Storage as AnyStorage>::Ref<'_, T>, <Self::Storage as AnyStorage>::Ref<'_, E>>where
T: 'static,
E: 'static,
Source§impl<W> ReadableStringExt for W
impl<W> ReadableStringExt for W
Source§impl<T, R> ReadableVecExt<T> for R
impl<T, R> ReadableVecExt<T> for R
Source§fn first(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
fn first(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
Source§fn last(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
fn last(&self) -> Option<<Self::Storage as AnyStorage>::Ref<'_, T>>where
T: 'static,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.