pub struct ShardState<T> { /* private fields */ }Expand description
Reactive state owned by a route or router controller.
Reads subscribe the current UI phase to changes. Handles remain valid while their owner lives and must be accessed on the owning UI session.
Implementations§
Source§impl<T: Send + Sync + 'static> ShardState<T>
impl<T: Send + Sync + 'static> ShardState<T>
Sourcepub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
Reads the value and subscribes the active UI phase to its changes.
Sourcepub fn with_mut<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
pub fn with_mut<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
Updates the value and invalidates its UI consumers.
Sourcepub fn try_with<R>(&self, f: impl FnOnce(&T) -> R) -> Result<R, ShardStateError>
pub fn try_with<R>(&self, f: impl FnOnce(&T) -> R) -> Result<R, ShardStateError>
Reads live state, reporting an expired controller or route.
Sourcepub fn try_with_mut<R>(
&self,
f: impl FnOnce(&mut T) -> R,
) -> Result<R, ShardStateError>
pub fn try_with_mut<R>( &self, f: impl FnOnce(&mut T) -> R, ) -> Result<R, ShardStateError>
Updates live state, reporting an expired controller or route.
Trait Implementations§
Source§impl<T> Clone for ShardState<T>
impl<T> Clone for ShardState<T>
impl<T> Copy for ShardState<T>
impl<T> Eq for ShardState<T>
Source§impl<T> Hash for ShardState<T>
impl<T> Hash for ShardState<T>
Auto Trait Implementations§
impl<T> Freeze for ShardState<T>
impl<T> RefUnwindSafe for ShardState<T>where
T: RefUnwindSafe,
impl<T> Send for ShardState<T>where
T: Send,
impl<T> Sync for ShardState<T>where
T: Sync,
impl<T> Unpin for ShardState<T>where
T: Unpin,
impl<T> UnsafeUnpin for ShardState<T>
impl<T> UnwindSafe for ShardState<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more