ReadSignal

Struct ReadSignal 

Source
pub struct ReadSignal<T: ?Sized, S: BoxedSignalStorage<T> = UnsyncStorage> { /* private fields */ }
Expand description

A boxed version of Readable that can be used to store any readable type.

Implementations§

Source§

impl<T: ?Sized + 'static> ReadSignal<T>

Source

pub fn new( value: impl Readable<Target = T, Storage = UnsyncStorage> + 'static, ) -> Self

Create a new boxed readable value.

Source§

impl<T: ?Sized + 'static, S: BoxedSignalStorage<T>> ReadSignal<T, S>

Source

pub fn new_maybe_sync<R>(value: R) -> Self
where S: CreateBoxedSignalStorage<R>, R: Readable<Target = T>,

Create a new boxed readable value which may be sync

Source

pub fn point_to(&self, other: Self) -> BorrowResult

Point to another ReadSignal. This will subscribe the other ReadSignal to all subscribers of this ReadSignal.

Trait Implementations§

Source§

impl<T: ?Sized, S: BoxedSignalStorage<T>> Clone for ReadSignal<T, S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + 'static, S: BoxedSignalStorage<T>> Debug for ReadSignal<T, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + 'static, S: CreateBoxedSignalStorage<Signal<T, S>> + BoxedSignalStorage<T> + Storage<SignalData<T>>> Default for ReadSignal<T, S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + 'static, S: BoxedSignalStorage<T>> Deref for ReadSignal<T, S>

Source§

type Target = dyn Fn() -> T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Display + 'static, S: BoxedSignalStorage<T>> Display for ReadSignal<T, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: 'static, S: CreateBoxedSignalStorage<CopyValue<T, S>> + BoxedSignalStorage<T> + Storage<T>> From<CopyValue<T, S>> for ReadSignal<T, S>

Source§

fn from(value: CopyValue<T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T, R> From<Global<T, R>> for ReadSignal<R>
where T: Readable<Target = R, Storage = UnsyncStorage> + InitializeFromFunction<R> + Clone + 'static, R: 'static,

Source§

fn from(value: Global<T, R>) -> Self

Converts to this type from the input type.
Source§

impl<V, O, F, FMut, S> From<MappedMutSignal<O, V, F, FMut>> for ReadSignal<O, S>
where O: ?Sized + 'static, V: Readable<Storage = S> + 'static, F: Fn(&V::Target) -> &O + 'static, FMut: 'static, S: BoxedSignalStorage<O> + CreateBoxedSignalStorage<MappedMutSignal<O, V, F, FMut>>,

Source§

fn from(value: MappedMutSignal<O, V, F, FMut>) -> Self

Converts to this type from the input type.
Source§

impl<V, O, F, S> From<MappedSignal<O, V, F>> for ReadSignal<O, S>
where O: ?Sized + 'static, V: Readable<Storage = S> + 'static, F: Fn(&V::Target) -> &O + 'static, S: BoxedSignalStorage<O> + CreateBoxedSignalStorage<MappedSignal<O, V, F>>,

Source§

fn from(value: MappedSignal<O, V, F>) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq + 'static> From<Memo<T>> for ReadSignal<T>

Source§

fn from(value: Memo<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: 'static, S: CreateBoxedSignalStorage<Signal<T, S>> + BoxedSignalStorage<T> + Storage<SignalData<T>>> From<Signal<T, S>> for ReadSignal<T, S>

Source§

fn from(value: Signal<T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T: ?Sized + 'static, S> From<WriteSignal<T, S>> for ReadSignal<T, S>

Source§

fn from(value: WriteSignal<T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T, S: BoxedSignalStorage<T>> IntoAttributeValue for ReadSignal<T, S>
where T: Clone + IntoAttributeValue + 'static,

Source§

fn into_value(self) -> AttributeValue

Convert into an attribute value
Source§

impl<T, S> IntoDynNode for ReadSignal<T, S>
where T: Clone + IntoDynNode + 'static, S: BoxedSignalStorage<T>,

Source§

fn into_dyn_node(self) -> DynamicNode

Consume this item and produce a DynamicNode
Source§

impl<T: PartialEq + 'static, S: BoxedSignalStorage<T>> PartialEq<T> for ReadSignal<T, S>

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ?Sized, S: BoxedSignalStorage<T>> PartialEq for ReadSignal<T, S>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ?Sized, S: BoxedSignalStorage<T>> Readable for ReadSignal<T, S>

Source§

type Target = T

The target type of the reference.
Source§

type Storage = S

The type of the storage this readable uses.
Source§

fn try_read_unchecked(&self) -> Result<ReadableRef<'static, Self>, BorrowError>
where T: 'static,

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) -> BorrowResult<ReadableRef<'static, Self>>
where T: '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. Read more
Source§

fn subscribers(&self) -> Subscribers
where T: 'static,

Get the underlying subscriber list for this readable. This is used to track when the value changes and notify subscribers.
Source§

impl<T: ?Sized, S: BoxedSignalStorage<T>> Copy for ReadSignal<T, S>

Auto Trait Implementations§

§

impl<T, S> Freeze for ReadSignal<T, S>
where T: ?Sized,

§

impl<T, S> RefUnwindSafe for ReadSignal<T, S>
where S: RefUnwindSafe, <S as BoxedSignalStorage<T>>::DynReadable<SealedToken>: RefUnwindSafe, T: ?Sized,

§

impl<T, S> Send for ReadSignal<T, S>
where S: Sync, <S as BoxedSignalStorage<T>>::DynReadable<SealedToken>: Send, T: ?Sized,

§

impl<T, S> Sync for ReadSignal<T, S>
where S: Sync, <S as BoxedSignalStorage<T>>::DynReadable<SealedToken>: Sync, T: ?Sized,

§

impl<T, S> Unpin for ReadSignal<T, S>
where T: ?Sized,

§

impl<T, S> UnwindSafe for ReadSignal<T, S>
where S: RefUnwindSafe, <S as BoxedSignalStorage<T>>::DynReadable<SealedToken>: UnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R> ReadableBoxExt for R
where R: Readable<Storage = UnsyncStorage> + ?Sized,

Source§

fn boxed(self) -> ReadSignal<Self::Target>
where Self: Sized + 'static,

Box the readable value into a trait object. This is useful for passing around readable values without knowing their concrete type.
Source§

impl<R> ReadableExt for R
where R: Readable + ?Sized,

Source§

fn read(&self) -> ReadableRef<'_, Self>
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<ReadableRef<'_, Self>, 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) -> ReadableRef<'static, Self>
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) -> ReadableRef<'_, Self>
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<ReadableRef<'_, Self>, 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) -> ReadableRef<'static, Self>
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>
where Self: Clone + Sized, F: Fn(&Self::Target) -> &O,

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
where Self::Target: Clone + 'static,

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) -> O
where Self::Target: 'static,

Run a function with a reference to the value. If the value has been dropped, this will panic.
Source§

fn with_peek<O>(&self, f: impl FnOnce(&Self::Target) -> O) -> O
where Self::Target: 'static,

Run a function with a reference to the value. If the value has been dropped, this will panic.
Source§

fn index<I>( &self, index: I, ) -> ReadableRef<'_, Self, <Self::Target as Index<I>>::Output>
where Self::Target: Index<I> + 'static,

Index into the inner value and return a reference to the result. If the value has been dropped or the index is invalid, this will panic.
Source§

impl<K, V, H, R> ReadableHashMapExt<K, V, H> for R
where K: 'static, V: 'static, H: 'static, R: Readable<Target = HashMap<K, V, H>>,

Source§

fn is_empty(&self) -> bool

Check if the hashmap is empty.
Source§

fn len(&self) -> usize

Get the length of the hashmap.
Source§

fn capacity(&self) -> usize

Get the capacity of the hashmap.
Source§

fn get(&self, key: &K) -> Option<ReadableRef<'_, Self, V>>
where K: Hash + Eq, H: BuildHasher,

Get the value for the given key.
Source§

fn contains_key(&self, key: &K) -> bool
where K: Hash + Eq, H: BuildHasher,

Check if the hashmap contains the given key.
Source§

impl<V, H, R> ReadableHashSetExt<V, H> for R
where V: 'static, H: 'static, R: Readable<Target = HashSet<V, H>>,

Source§

fn is_empty(&self) -> bool

Check if the hashset is empty.
Source§

fn len(&self) -> usize

Get the length of the hashset.
Source§

fn capacity(&self) -> usize

Get the capacity of the hashset.
Source§

fn contains(&self, value: &V) -> bool
where V: Hash + Eq, H: BuildHasher,

Check if the hashset contains the given value.
Source§

impl<T, R> ReadableOptionExt<T> for R
where R: Readable<Target = Option<T>>,

Source§

fn unwrap(&self) -> T
where T: Clone + 'static,

Unwraps the inner value and clones it.
Source§

fn as_ref(&self) -> Option<ReadableRef<'_, Self, T>>
where T: 'static,

Attempts to read the inner value of the Option.
Source§

impl<T, E, R> ReadableResultExt<T, E> for R
where R: Readable<Target = Result<T, E>>,

Source§

fn unwrap(&self) -> T
where T: Clone + 'static, E: 'static,

Unwraps the inner value and clones it.
Source§

fn as_ref(&self) -> Result<ReadableRef<'_, Self, T>, ReadableRef<'_, Self, E>>
where T: 'static, E: 'static,

Attempts to read the inner value of the Option.
Source§

impl<W> ReadableStringExt for W
where W: Readable<Target = String>,

Source§

fn capacity(&self) -> usize

Check the capacity of the string.
Source§

impl<T, R> ReadableVecExt<T> for R
where R: Readable<Target = Vec<T>>,

Source§

fn len(&self) -> usize
where T: 'static,

Returns the length of the inner vector.
Source§

fn is_empty(&self) -> bool
where T: 'static,

Returns true if the inner vector is empty.
Source§

fn first(&self) -> Option<ReadableRef<'_, Self, T>>
where T: 'static,

Get the first element of the inner vector.
Source§

fn last(&self) -> Option<ReadableRef<'_, Self, T>>
where T: 'static,

Get the last element of the inner vector.
Source§

fn get(&self, index: usize) -> Option<ReadableRef<'_, Self, T>>
where T: 'static,

Get the element at the given index of the inner vector.
Source§

fn iter(&self) -> ReadableValueIterator<'_, Self>
where Self: Sized,

Get an iterator over the values of the inner vector.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more