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 copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§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>
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> 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
impl<T, S> Copy for StoredValue<T, S>
impl<T, S> Eq for StoredValue<T, S>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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<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<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<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.
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.