pub struct MappedSignal<T, S = SyncStorage> { /* private fields */ }Expand description
A derived signal type that wraps an RwSignal with a mapping function,
allowing you to read or write directly to one of its field.
Tracking the mapped signal tracks changes to any part of the signal, and updating the signal notifies and notifies all dependencies of the signal. This is not a mechanism for fine-grained reactive updates to more complex data structures. Instead, it allows you to provide a signal-like API for wrapped types without exposing the original type directly to users.
Implementations§
Trait Implementations§
Source§impl<T> Clone for MappedSignal<T>
impl<T> Clone for MappedSignal<T>
Source§impl<T> Debug for MappedSignal<T>
impl<T> Debug for MappedSignal<T>
Source§impl<T> DefinedAt for MappedSignal<T>
impl<T> DefinedAt for MappedSignal<T>
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> From<ArcMappedSignal<T>> for MappedSignal<T>where
T: 'static,
impl<T> From<ArcMappedSignal<T>> for MappedSignal<T>where
T: 'static,
Source§fn from(value: ArcMappedSignal<T>) -> Self
fn from(value: ArcMappedSignal<T>) -> Self
Converts to this type from the input type.
Source§impl<T> From<MappedSignal<T>> for Signal<T>
impl<T> From<MappedSignal<T>> for Signal<T>
Source§fn from(value: MappedSignal<T>) -> Self
fn from(value: MappedSignal<T>) -> Self
Converts to this type from the input type.
Source§impl<T> IsDisposed for MappedSignal<T>
impl<T> IsDisposed for MappedSignal<T>
Source§fn is_disposed(&self) -> bool
fn is_disposed(&self) -> bool
If
true, the signal cannot be accessed without a panic.Source§impl<T> Notify for MappedSignal<T>where
T: 'static,
impl<T> Notify for MappedSignal<T>where
T: 'static,
Source§impl<T> ReadUntracked for MappedSignal<T>where
T: 'static,
impl<T> ReadUntracked for MappedSignal<T>where
T: 'static,
Source§type Value = DoubleDeref<Box<dyn Deref<Target = T>>>
type Value = DoubleDeref<Box<dyn Deref<Target = T>>>
The guard type that will be returned, which can be dereferenced to the value.
Source§fn try_read_untracked(&self) -> Option<Self::Value>
fn try_read_untracked(&self) -> Option<Self::Value>
Returns the guard, or
None if the signal has already been disposed.Source§fn read_untracked(&self) -> Self::Value
fn read_untracked(&self) -> Self::Value
Returns the guard. Read more
Source§fn custom_try_read(&self) -> Option<Option<Self::Value>>
fn custom_try_read(&self) -> Option<Option<Self::Value>>
This is a backdoor to allow overriding the
Read::try_read implementation despite it being auto implemented. Read moreSource§impl<T> Track for MappedSignal<T>where
T: 'static,
impl<T> Track for MappedSignal<T>where
T: 'static,
Source§impl<T> Write for MappedSignal<T>where
T: 'static,
impl<T> Write for MappedSignal<T>where
T: 'static,
impl<T> Copy for MappedSignal<T>
Auto Trait Implementations§
impl<T, S> Freeze for MappedSignal<T, S>
impl<T, S> RefUnwindSafe for MappedSignal<T, S>
impl<T, S> Send for MappedSignal<T, S>
impl<T, S> Sync for MappedSignal<T, S>
impl<T, S> Unpin for MappedSignal<T, S>
impl<T, S> UnwindSafe for MappedSignal<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<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> Read for Twhere
T: Track + ReadUntracked,
impl<T> Read for Twhere
T: Track + ReadUntracked,
Source§impl<T> Set for Twhere
T: Update + IsDisposed,
impl<T> Set for Twhere
T: Update + IsDisposed,
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> Update for Twhere
T: Write,
impl<T> Update for Twhere
T: Write,
Source§fn try_maybe_update<U>(
&self,
fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U),
) -> Option<U>
fn try_maybe_update<U>( &self, fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U), ) -> Option<U>
Updates the value of the signal, notifying subscribers if the update function returns
(true, _), and returns the value returned by the update function,
or None if the signal has already been disposed.Source§fn update(&self, fun: impl FnOnce(&mut Self::Value))
fn update(&self, fun: impl FnOnce(&mut Self::Value))
Updates the value of the signal and notifies subscribers.
Source§impl<T> UpdateUntracked for Twhere
T: Write,
impl<T> UpdateUntracked for Twhere
T: Write,
Source§fn try_update_untracked<U>(
&self,
fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U,
) -> Option<U>
fn try_update_untracked<U>( &self, fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U, ) -> Option<U>
Updates the value by applying a function, returning the value returned by that function,
or
None if the signal has already been disposed.
Does not notify subscribers that the signal has changed.Source§impl<T> With for Twhere
T: Read,
impl<T> With for Twhere
T: Read,
Source§type Value = <<T as Read>::Value as Deref>::Target
type Value = <<T as Read>::Value as Deref>::Target
The type of the value contained in the signal.
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> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
Source§type Value = <<T as ReadUntracked>::Value as Deref>::Target
type Value = <<T as ReadUntracked>::Value as Deref>::Target
The type of the value contained in the signal.
Source§fn try_with_untracked<U>(
&self,
fun: impl FnOnce(&<T as WithUntracked>::Value) -> U,
) -> Option<U>
fn try_with_untracked<U>( &self, fun: impl FnOnce(&<T as WithUntracked>::Value) -> U, ) -> Option<U>
Applies the closure to the value, and returns the result,
or
None if the signal has already been disposed.