Merge pull request #1047 from serzhiio/master

Added `.with_mut_silent()` fn
This commit is contained in:
Jon Kelley 2023-05-29 15:02:38 +02:00 committed by GitHub
commit eee62f6d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -70,6 +70,12 @@ impl<T: 'static> UseAtomRef<T> {
self.value.borrow()
}
/// This is silent operation
/// call `.force_update()` manually if required
pub fn with_mut_silent(&self, cb: impl FnOnce(&mut T)) {
cb(&mut *self.write_silent())
}
pub fn write(&self) -> RefMut<T> {
self.root.force_update(self.ptr);
self.value.borrow_mut()