pub struct MappedSignal<O, V, F = fn(&<V as Readable>::Target) -> &O>where
O: ?Sized,{ /* private fields */ }Expand description
A read only signal that has been mapped to a new type.
Implementations§
Source§impl<V, O, F> MappedSignal<O, V, F>where
O: ?Sized,
impl<V, O, F> MappedSignal<O, V, F>where
O: ?Sized,
Sourcepub fn new(value: V, map_fn: F) -> MappedSignal<O, V, F>
pub fn new(value: V, map_fn: F) -> MappedSignal<O, V, F>
Create a new mapped signal.
Trait Implementations§
Source§impl<V, O, F> Clone for MappedSignal<O, V, F>
impl<V, O, F> Clone for MappedSignal<O, V, F>
Source§fn clone(&self) -> MappedSignal<O, V, F>
fn clone(&self) -> MappedSignal<O, V, F>
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<V, O, F> Copy for MappedSignal<O, V, F>
Source§impl<T, V, F> Debug for MappedSignal<T, V, F>
impl<T, V, F> Debug for MappedSignal<T, V, F>
Source§impl<V, O, F> Deref for MappedSignal<O, V, F>
Allow calling a signal with signal() syntax
impl<V, O, F> Deref for MappedSignal<O, V, F>
Allow calling a signal with signal() syntax
Currently only limited to clone types, though could probably specialize for string/arc/rc
Source§impl<T, V, F> Display for MappedSignal<T, V, F>
impl<T, V, F> Display for MappedSignal<T, V, F>
Source§impl<V, O, F, S> From<MappedSignal<O, V, F>> for ReadSignal<O, S>where
O: 'static + ?Sized,
V: Readable<Storage = S> + 'static,
F: Fn(&<V as Readable>::Target) -> &O + 'static,
S: BoxedSignalStorage<O> + CreateBoxedSignalStorage<MappedSignal<O, V, F>>,
impl<V, O, F, S> From<MappedSignal<O, V, F>> for ReadSignal<O, S>where
O: 'static + ?Sized,
V: Readable<Storage = S> + 'static,
F: Fn(&<V as Readable>::Target) -> &O + 'static,
S: BoxedSignalStorage<O> + CreateBoxedSignalStorage<MappedSignal<O, V, F>>,
Source§fn from(value: MappedSignal<O, V, F>) -> ReadSignal<O, S>
fn from(value: MappedSignal<O, V, F>) -> ReadSignal<O, S>
Converts to this type from the input type.
Source§impl<V, O, F> IntoAttributeValue for MappedSignal<O, V, F>
impl<V, O, F> IntoAttributeValue for MappedSignal<O, V, F>
Source§fn into_value(self) -> AttributeValue
fn into_value(self) -> AttributeValue
Convert into an attribute value
Source§impl<V, O, F> PartialEq for MappedSignal<O, V, F>
impl<V, O, F> PartialEq for MappedSignal<O, V, F>
Source§impl<T, V, F> PartialEq<T> for MappedSignal<T, V, F>
impl<T, V, F> PartialEq<T> for MappedSignal<T, V, F>
Source§impl<V, O, F> Readable for MappedSignal<O, V, F>
impl<V, O, F> Readable for MappedSignal<O, V, F>
Source§fn try_read_unchecked(
&self,
) -> Result<<<MappedSignal<O, V, F> as Readable>::Storage as AnyStorage>::Ref<'static, <MappedSignal<O, V, F> as Readable>::Target>, BorrowError>
fn try_read_unchecked( &self, ) -> Result<<<MappedSignal<O, V, F> as Readable>::Storage as AnyStorage>::Ref<'static, <MappedSignal<O, V, F> as Readable>::Target>, BorrowError>
Try to get a reference to the value without checking the lifetime. This will subscribe the current scope to the signal. Read more
Source§fn try_peek_unchecked(
&self,
) -> Result<<<MappedSignal<O, V, F> as Readable>::Storage as AnyStorage>::Ref<'static, <MappedSignal<O, V, F> as Readable>::Target>, BorrowError>
fn try_peek_unchecked( &self, ) -> Result<<<MappedSignal<O, V, F> as Readable>::Storage as AnyStorage>::Ref<'static, <MappedSignal<O, V, F> as Readable>::Target>, BorrowError>
Try to peek the current value of the signal without subscribing to updates. If the value has
been dropped, this will return an error. Read more
Source§fn subscribers(&self) -> Subscribers
fn subscribers(&self) -> Subscribers
Get the underlying subscriber list for this readable. This is used to track when the value changes and notify subscribers.
Auto Trait Implementations§
impl<O, V, F> Freeze for MappedSignal<O, V, F>
impl<O, V, F> RefUnwindSafe for MappedSignal<O, V, F>
impl<O, V, F> Send for MappedSignal<O, V, F>
impl<O, V, F> Sync for MappedSignal<O, V, F>
impl<O, V, F> Unpin for MappedSignal<O, V, F>
impl<O, V, F> UnsafeUnpin for MappedSignal<O, V, F>
impl<O, V, F> UnwindSafe for MappedSignal<O, V, F>
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,
impl<T> DependencyElement 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
Create an instance of this type from an initialization function
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<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,
Get the current value of the state. If this is a signal, this will subscribe the current scope to the signal.
If the value has been dropped, this will panic. Calling this on a Signal is the same as
using the signal() syntax to read and subscribe to its value
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,
Try to get the current value of the state. If this is a signal, this will subscribe the current scope to the signal.
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,
Get a reference to the value without checking the lifetime. This will subscribe the current scope to the signal. Read more
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,
Get the current value of the state without subscribing to updates. If the value has been dropped, this will panic. Read more
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,
Try to peek the current value of the signal without subscribing to updates. If the value has
been dropped, this will return an error.
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,
Get the current value of the signal without checking the lifetime. Unlike read, this will not subscribe the current scope to the signal which can cause parts of your UI to not update. Read more
Source§fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
fn map<F, O>(self, f: F) -> MappedSignal<O, Self, F>
Map the references of the readable value to a new type. This lets you provide a view
into the readable value without creating a new signal or cloning the value. Read more
Source§fn cloned(&self) -> Self::Target
fn cloned(&self) -> Self::Target
Clone the inner value and return it. If the value has been dropped, this will panic.
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,
Run a function with a reference to the value. If the value has been dropped, this will panic.
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,
Unwraps the inner value and clones it.
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,
Attempts to read the inner value of the Option.
Source§impl<W> ReadableStrExt for W
impl<W> ReadableStrExt for W
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,
Get the first element of the inner vector.
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,
Get the last element of the inner vector.
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
Convert from a type to another type.
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
Convert from a type to another type.