Struct fermi::hooks::UseAtomRef
source · pub struct UseAtomRef<T> { /* private fields */ }
Implementations§
source§impl<T: 'static> UseAtomRef<T>
impl<T: 'static> UseAtomRef<T>
pub fn read(&self) -> Ref<'_, T>
sourcepub fn with_mut_silent(&self, cb: impl FnOnce(&mut T))
pub fn with_mut_silent(&self, cb: impl FnOnce(&mut T))
This is silent operation
call .force_update()
manually if required
pub fn write(&self) -> RefMut<'_, T>
sourcepub fn write_silent(&self) -> RefMut<'_, T>
pub fn write_silent(&self) -> RefMut<'_, T>
Silent write to AtomRef does not update Subscribed scopes
sourcepub fn unsubscribe(&self, cx: &ScopeState)
pub fn unsubscribe(&self, cx: &ScopeState)
Do not update provided context on Write ops Example:
ⓘ
static ATOM_DATA: AtomRef<Collection> = |_| Default::default();
fn App(cx: Scope) {
use_init_atom_root(cx);
let atom_data = use_atom_ref(cx, ATOM_DATA);
atom_data.unsubscribe(cx);
atom_data.write().update();
}
sourcepub fn force_update(&self)
pub fn force_update(&self)
Force update of subscribed Scopes
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for UseAtomRef<T>
impl<T> !Send for UseAtomRef<T>
impl<T> !Sync for UseAtomRef<T>
impl<T> Unpin for UseAtomRef<T>
impl<T> !UnwindSafe for UseAtomRef<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