pub struct Signal<T> {
pub value: Arc<RwLock<T>>,
/* private fields */
}
Expand description
A reactive signal that holds a value
Fields§
§value: Arc<RwLock<T>>
Implementations§
Source§impl<T> Signal<T>
impl<T> Signal<T>
Sourcepub fn get(&self) -> RwLockReadGuard<'_, T>
pub fn get(&self) -> RwLockReadGuard<'_, T>
Get the current value of the signal
Sourcepub fn get_mut(&self) -> RwLockWriteGuard<'_, T>
pub fn get_mut(&self) -> RwLockWriteGuard<'_, T>
Get a mutable reference to the signal’s value
Sourcepub fn set(&self, value: T) -> Result<(), SignalError>
pub fn set(&self, value: T) -> Result<(), SignalError>
Set the signal’s value and trigger updates
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> RefUnwindSafe for Signal<T>
impl<T> Unpin for Signal<T>
impl<T> UnwindSafe for Signal<T>
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