pub struct TVar<T> { /* private fields */ }
Expand description
Implementations§
Source§impl<T: Any + Sync + Send + Clone> TVar<T>
impl<T: Any + Sync + Send + Clone> TVar<T>
Sourcepub fn read_clone(&self) -> Stm<T>
pub fn read_clone(&self) -> Stm<T>
Read the value of the TVar as a clone, for subsequent modification. Only call this inside [atomically].
Sourcepub fn read(&self) -> Stm<Arc<T>>
pub fn read(&self) -> Stm<Arc<T>>
Read the value of the TVar. Only call this inside [atomically].
Sourcepub fn write(&self, value: T) -> Stm<()>
pub fn write(&self, value: T) -> Stm<()>
Replace the value of the TVar. Only call this inside [atomically].
Sourcepub fn update<F>(&self, f: F) -> Stm<()>where
F: FnOnce(T) -> T,
pub fn update<F>(&self, f: F) -> Stm<()>where
F: FnOnce(T) -> T,
Apply an update on the value of the TVar. Only call this inside [atomically].
Sourcepub fn update_mut<F>(&self, f: F) -> Stm<()>
pub fn update_mut<F>(&self, f: F) -> Stm<()>
Apply an update on the value of the TVar. Only call this inside [atomically].
Sourcepub fn modify<F, R>(&self, f: F) -> Stm<R>
pub fn modify<F, R>(&self, f: F) -> Stm<R>
Apply an update on the value of the TVar and return a value. Only call this inside [atomically].
Sourcepub fn modify_mut<F, R>(&self, f: F) -> Stm<R>
pub fn modify_mut<F, R>(&self, f: F) -> Stm<R>
Apply an update on the value of the TVar and return a value. Only call this inside [atomically].
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TVar<T>
impl<T> !RefUnwindSafe for TVar<T>
impl<T> Send for TVar<T>where
T: Send,
impl<T> Sync for TVar<T>where
T: Sync,
impl<T> Unpin for TVar<T>where
T: Unpin,
impl<T> !UnwindSafe for TVar<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