ReadSignal

Struct ReadSignal 

Source
pub struct ReadSignal<T, S = UnsyncStorage>
where S: BoxedSignalStorage<T>, T: ?Sized,
{ /* private fields */ }
Available on crate feature prelude only.
Expand description

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

Implementations§

Source§

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

Source

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

Create a new boxed readable value.

Source§

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

Source

pub fn new_maybe_sync<R>(value: R) -> ReadSignal<T, S>
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: ReadSignal<T, S>) -> Result<(), BorrowError>

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

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> ReadSignal<T, S>

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, S> Debug for ReadSignal<T, S>
where T: Debug + 'static, S: BoxedSignalStorage<T>,

Source§

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

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

impl<T, S> Default for ReadSignal<T, S>

Source§

fn default() -> ReadSignal<T, S>

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

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

Source§

type Target = dyn Fn() -> T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<ReadSignal<T, S> as Deref>::Target

Dereferences the value.
Source§

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

Source§

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

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

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

Source§

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

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>) -> ReadSignal<R>

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: 'static + ?Sized, V: Readable<Storage = S> + 'static, F: Fn(&<V as Readable>::Target) -> &O + 'static, FMut: 'static, S: BoxedSignalStorage<O> + CreateBoxedSignalStorage<MappedMutSignal<O, V, F, FMut>>,

Source§

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

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: '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>

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<T> From<Resource<T>> for ReadSignal<Option<T>>

Source§

fn from(val: Resource<T>) -> ReadSignal<Option<T>>

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<UseFuture> for ReadSignal<UseFutureState>

Source§

fn from(val: UseFuture) -> ReadSignal<UseFutureState>

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<T, S> IntoAttributeValue for ReadSignal<T, S>
where S: BoxedSignalStorage<T>, 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, S> PartialEq<T> for ReadSignal<T, S>
where T: PartialEq + 'static, S: BoxedSignalStorage<T>,

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, S> PartialEq for ReadSignal<T, S>
where S: BoxedSignalStorage<T>, T: ?Sized,

Source§

fn eq(&self, other: &ReadSignal<T, S>) -> 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, S> Readable for ReadSignal<T, S>
where S: BoxedSignalStorage<T>, T: ?Sized,

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<<<ReadSignal<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <ReadSignal<T, S> as Readable>::Target>, 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, ) -> Result<<<ReadSignal<T, S> as Readable>::Storage as AnyStorage>::Ref<'static, <ReadSignal<T, S> as Readable>::Target>, BorrowError>
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, S> Copy for ReadSignal<T, S>
where S: BoxedSignalStorage<T>, T: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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) -> <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,

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,

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,

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,

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,

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: Sized + Clone, 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, ) -> <Self::Storage as AnyStorage>::Ref<'_, <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<<Self::Storage as AnyStorage>::Ref<'_, 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<<Self::Storage as AnyStorage>::Ref<'_, 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<<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> 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<<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,

Get the last element of the inner vector.
Source§

fn get(&self, index: usize) -> Option<<Self::Storage as AnyStorage>::Ref<'_, 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<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSmolStr for T
where T: Display + ?Sized,

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> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> Brush for T
where T: Clone + PartialEq + Default + Debug,

Source§

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WasmNotSync for T
where T: Sync,