Struct Signal
pub struct Signal<T> { /* private fields */ }Expand description
A local (UI-thread) read write Signal.
Implementations§
§impl<T> Signal<T>
impl<T> Signal<T>
pub fn id(&self) -> Id
pub fn read_only(&self) -> ReadSignal<T>
pub fn read_only(&self) -> ReadSignal<T>
Create a Getter of this Signal
pub fn write_only(&self) -> WriteSignal<T>
pub fn write_only(&self) -> WriteSignal<T>
Create a Setter of this Signal
§impl<T> Signal<T>where
T: 'static,
impl<T> Signal<T>where
T: 'static,
pub fn new(value: T) -> Signal<T>
pub fn new_split(value: T) -> (ReadSignal<T>, WriteSignal<T>)
Trait Implementations§
§impl<T> AddAssign<T> for Signal<T>where
T: AddAssign + 'static,
impl<T> AddAssign<T> for Signal<T>where
T: AddAssign + 'static,
§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read more§impl<T> BitAndAssign<T> for Signal<T>where
T: BitAndAssign + 'static,
impl<T> BitAndAssign<T> for Signal<T>where
T: BitAndAssign + 'static,
§fn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
Performs the
&= operation. Read more§impl<T> BitOrAssign<T> for Signal<T>where
T: BitOrAssign + 'static,
impl<T> BitOrAssign<T> for Signal<T>where
T: BitOrAssign + 'static,
§fn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
Performs the
|= operation. Read more§impl<T> BitXorAssign<T> for Signal<T>where
T: BitXorAssign + 'static,
impl<T> BitXorAssign<T> for Signal<T>where
T: BitXorAssign + 'static,
§fn bitxor_assign(&mut self, rhs: T)
fn bitxor_assign(&mut self, rhs: T)
Performs the
^= operation. Read more§impl<T> DivAssign<T> for Signal<T>where
T: DivAssign + 'static,
impl<T> DivAssign<T> for Signal<T>where
T: DivAssign + 'static,
§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read more§impl<T> MulAssign<T> for Signal<T>where
T: MulAssign + 'static,
impl<T> MulAssign<T> for Signal<T>where
T: MulAssign + 'static,
§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read more§impl<T> RemAssign<T> for Signal<T>where
T: RemAssign + 'static,
impl<T> RemAssign<T> for Signal<T>where
T: RemAssign + 'static,
§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the
%= operation. Read moreSource§impl<T> Res<T> for Signal<T>where
T: Clone + 'static,
impl<T> Res<T> for Signal<T>where
T: Clone + 'static,
Source§fn get_value(&self, _: &impl DataContext) -> T
fn get_value(&self, _: &impl DataContext) -> T
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
§impl<T> ShlAssign<T> for Signal<T>where
T: ShlAssign + 'static,
impl<T> ShlAssign<T> for Signal<T>where
T: ShlAssign + 'static,
§fn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
Performs the
<<= operation. Read more§impl<T> ShrAssign<T> for Signal<T>where
T: ShrAssign + 'static,
impl<T> ShrAssign<T> for Signal<T>where
T: ShrAssign + 'static,
§fn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
Performs the
>>= operation. Read more§impl<T> SignalRead<T> for Signal<T>
impl<T> SignalRead<T> for Signal<T>
§fn try_read(&self) -> Option<ReadRef<'_, T>>where
T: 'static,
fn try_read(&self) -> Option<ReadRef<'_, T>>where
T: 'static,
If the signal isn’t disposed,
reads the data stored in the Signal and subscribes to the current running effect.
§fn try_read_untracked(&self) -> Option<ReadRef<'_, T>>where
T: 'static,
fn try_read_untracked(&self) -> Option<ReadRef<'_, T>>where
T: 'static,
If the signal isn’t disposed,
reads the data stored in the Signal without subscribing.
§fn read(&self) -> ReadRef<'_, T>where
T: 'static,
fn read(&self) -> ReadRef<'_, T>where
T: 'static,
Reads the data stored in the Signal, subscribing the current running effect.
§fn read_untracked(&self) -> ReadRef<'_, T>where
T: 'static,
fn read_untracked(&self) -> ReadRef<'_, T>where
T: 'static,
Reads the data stored in the Signal without subscribing.
§impl<T> SignalTrack<T> for Signal<T>
impl<T> SignalTrack<T> for Signal<T>
§impl<T> SignalUpdate<T> for Signal<T>
impl<T> SignalUpdate<T> for Signal<T>
§fn set(&self, new_value: T)where
T: 'static,
fn set(&self, new_value: T)where
T: 'static,
Sets the new_value to the Signal and triggers effect run
§fn update(&self, f: impl FnOnce(&mut T))where
T: 'static,
fn update(&self, f: impl FnOnce(&mut T))where
T: 'static,
Update the stored value with the given function and triggers effect run
§fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>where
T: 'static,
fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>where
T: 'static,
Update the stored value with the given function, triggers effect run,
and returns the value returned by the function
§fn set_if_changed(&self, new_value: T)where
T: PartialEq + 'static,
fn set_if_changed(&self, new_value: T)where
T: PartialEq + 'static,
Sets the new_value to the Signal and triggers effect run only if the value has changed
§impl<T> SignalWith<T> for Signal<T>
impl<T> SignalWith<T> for Signal<T>
fn with<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> Owhere
T: 'static,
fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> Owhere
T: 'static,
§impl<T> SignalWrite<T> for Signal<T>
impl<T> SignalWrite<T> for Signal<T>
§impl<T> SubAssign<T> for Signal<T>where
T: SubAssign + 'static,
impl<T> SubAssign<T> for Signal<T>where
T: SubAssign + 'static,
§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreimpl<T> Copy for Signal<T>
impl<T> Eq for Signal<T>
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> RefUnwindSafe for Signal<T>where
T: RefUnwindSafe,
impl<T> Send for Signal<T>where
T: Send,
impl<T> Sync for Signal<T>where
T: Sync,
impl<T> Unpin for Signal<T>where
T: Unpin,
impl<T> UnwindSafe for Signal<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.§fn as_any(&self) -> &(dyn Any + 'static)
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.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T, S> SignalMap<T> for Swhere
T: 'static,
S: SignalWith<T> + Copy + 'static,
impl<T, S> SignalMap<T> for Swhere
T: 'static,
S: SignalWith<T> + Copy + 'static,
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
Source§impl<T> ToStringLocalized for Twhere
T: ToString,
impl<T> ToStringLocalized for Twhere
T: ToString,
Source§fn to_string_local(&self, _cx: &impl DataContext) -> String
fn to_string_local(&self, _cx: &impl DataContext) -> String
Method for converting the current type to a
String via a translation using fluent.