pub struct StoredValue<T, S = SyncStorage> { /* private fields */ }Expand description
A non-reactive, Copy handle for any value.
This allows you to create a stable reference for any value by storing it within
the reactive system. Like the signal types (e.g., ReadSignal
and RwSignal), it is Copy and 'static. Unlike the signal
types, it is not reactive; accessing it does not cause effects to subscribe, and
updating it does not notify anything else.
Implementations§
Source§impl<T, S> StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
impl<T, S> StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
Sourcepub fn new_with_storage(value: T) -> StoredValue<T, S>
pub fn new_with_storage(value: T) -> StoredValue<T, S>
Stores the given value in the arena allocator.
Source§impl<T> StoredValue<T>
impl<T> StoredValue<T>
Sourcepub fn new(value: T) -> StoredValue<T>
pub fn new(value: T) -> StoredValue<T>
Stores the given value in the arena allocator.
Source§impl<T> StoredValue<T, LocalStorage>where
T: 'static,
impl<T> StoredValue<T, LocalStorage>where
T: 'static,
Sourcepub fn new_local(value: T) -> StoredValue<T, LocalStorage>
pub fn new_local(value: T) -> StoredValue<T, LocalStorage>
Stores the given value in the arena allocator.
Trait Implementations§
Source§impl<T, S> Clone for StoredValue<T, S>
impl<T, S> Clone for StoredValue<T, S>
Source§fn clone(&self) -> StoredValue<T, S>
fn clone(&self) -> StoredValue<T, S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T, S> Copy for StoredValue<T, S>
Source§impl<T, S> Debug for StoredValue<T, S>where
S: Debug,
impl<T, S> Debug for StoredValue<T, S>where
S: Debug,
Source§impl<T, S> Default for StoredValue<T, S>
impl<T, S> Default for StoredValue<T, S>
Source§fn default() -> StoredValue<T, S>
fn default() -> StoredValue<T, S>
Returns the “default value” for a type. Read more
Source§impl<T, S> DefinedAt for StoredValue<T, S>
impl<T, S> DefinedAt for StoredValue<T, S>
Source§fn defined_at(&self) -> Option<&'static Location<'static>>
fn defined_at(&self) -> Option<&'static Location<'static>>
Returns the location at which the signal was defined. This is usually simply
None in
release mode.Source§impl<T, S> Dispose for StoredValue<T, S>
impl<T, S> Dispose for StoredValue<T, S>
impl<T, S> Eq for StoredValue<T, S>
Source§impl<T> From<ArcStoredValue<T>> for StoredValue<T>
impl<T> From<ArcStoredValue<T>> for StoredValue<T>
Source§fn from(value: ArcStoredValue<T>) -> StoredValue<T>
fn from(value: ArcStoredValue<T>) -> StoredValue<T>
Converts to this type from the input type.
Source§impl<T, S> From<StoredValue<T, S>> for ArcStoredValue<T>where
S: Storage<ArcStoredValue<T>>,
impl<T, S> From<StoredValue<T, S>> for ArcStoredValue<T>where
S: Storage<ArcStoredValue<T>>,
Source§fn from(value: StoredValue<T, S>) -> ArcStoredValue<T>
fn from(value: StoredValue<T, S>) -> ArcStoredValue<T>
Converts to this type from the input type.
Source§impl<T, S> Hash for StoredValue<T, S>
impl<T, S> Hash for StoredValue<T, S>
Source§impl<T, S> IntoInner for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
impl<T, S> IntoInner for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
Source§impl<T, S> IsDisposed for StoredValue<T, S>
impl<T, S> IsDisposed for StoredValue<T, S>
Source§fn is_disposed(&self) -> bool
fn is_disposed(&self) -> bool
If
true, the signal cannot be accessed without a panic.Source§impl<T, S> PartialEq for StoredValue<T, S>
impl<T, S> PartialEq for StoredValue<T, S>
Source§impl<T, S> ReadValue for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
impl<T, S> ReadValue for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
Source§type Value = ReadGuard<T, Plain<T>>
type Value = ReadGuard<T, Plain<T>>
The guard type that will be returned, which can be dereferenced to the value.
Source§fn try_read_value(&self) -> Option<ReadGuard<T, Plain<T>>>
fn try_read_value(&self) -> Option<ReadGuard<T, Plain<T>>>
Returns the non-reactive guard, or
None if the value has already been disposed.Source§fn read_value(&self) -> Self::Value
fn read_value(&self) -> Self::Value
Returns the non-reactive guard. Read more
Source§impl<T, S> WriteValue for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
impl<T, S> WriteValue for StoredValue<T, S>where
T: 'static,
S: Storage<ArcStoredValue<T>>,
Source§fn try_write_value(&self) -> Option<UntrackedWriteGuard<T>>
fn try_write_value(&self) -> Option<UntrackedWriteGuard<T>>
Returns a non-reactive write guard, or
None if the value has already been disposed.Source§fn write_value(&self) -> UntrackedWriteGuard<Self::Value>
fn write_value(&self) -> UntrackedWriteGuard<Self::Value>
Returns a non-reactive write guard. Read more
Auto Trait Implementations§
impl<T, S> Freeze for StoredValue<T, S>
impl<T, S> RefUnwindSafe for StoredValue<T, S>
impl<T, S> Send for StoredValue<T, S>
impl<T, S> Sync for StoredValue<T, S>
impl<T, S> Unpin for StoredValue<T, S>
impl<T, S> UnsafeUnpin for StoredValue<T, S>
impl<T, S> UnwindSafe for StoredValue<T, 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
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,
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>
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.Source§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.Source§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.Source§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.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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
Converts
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>
Converts
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
impl<T> SerializableAny for T
Source§impl<T> SetValue for Twhere
T: WriteValue,
impl<T> SetValue for Twhere
T: WriteValue,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
Source§impl<T> UpdateValue for Twhere
T: WriteValue,
impl<T> UpdateValue for Twhere
T: WriteValue,
Source§type Value = <T as WriteValue>::Value
type Value = <T as WriteValue>::Value
The type of the value contained in the value.
Source§fn try_update_value<U>(
&self,
fun: impl FnOnce(&mut <T as UpdateValue>::Value) -> U,
) -> Option<U>
fn try_update_value<U>( &self, fun: impl FnOnce(&mut <T as UpdateValue>::Value) -> U, ) -> Option<U>
Updates the value, returning the value that is
returned by the update function, or
None if the value has already been disposed.Source§fn update_value(&self, fun: impl FnOnce(&mut Self::Value))
fn update_value(&self, fun: impl FnOnce(&mut Self::Value))
Updates the value.
impl<T> WasmNotSend for Twhere
T: Send,
impl<T> WasmNotSendSync for Twhere
T: WasmNotSend + WasmNotSync,
impl<T> WasmNotSync for Twhere
T: Sync,
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WithValue for T
impl<T> WithValue for T
Source§type Value = <<T as ReadValue>::Value as Deref>::Target
type Value = <<T as ReadValue>::Value as Deref>::Target
The type of the value contained in the value.