Struct dioxus_hooks::UseSharedState
source · pub struct UseSharedState<T> { /* private fields */ }
Expand description
State that is shared between components through the context system
Implementations§
sourcepub fn notify_consumers(&self)
pub fn notify_consumers(&self)
Notify all consumers of the state that it has changed. (This is called automatically when you call “write”)
sourcepub fn try_read(&self) -> UseSharedStateResult<Ref<'_, T>>
pub fn try_read(&self) -> UseSharedStateResult<Ref<'_, T>>
Try reading the shared state
sourcepub fn try_write(&self) -> UseSharedStateResult<RefMut<'_, T>>
pub fn try_write(&self) -> UseSharedStateResult<RefMut<'_, T>>
Try writing the shared state
sourcepub fn try_write_silent(&self) -> UseSharedStateResult<RefMut<'_, T>>
pub fn try_write_silent(&self) -> UseSharedStateResult<RefMut<'_, T>>
Tries writing the value without forcing a re-render
sourcepub fn write_silent(&self) -> RefMut<'_, T>
pub fn write_silent(&self) -> RefMut<'_, T>
Writes the value without forcing a re-render
Trait Implementations§
Auto Trait Implementations§
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