Struct consecuit::hooks::Updater [−][src]
pub struct Updater<T: 'static> { /* fields omitted */ }
Expand description
A handle returned by use_state for updating the state.
Updating the state will queue a rerender.
Implementations
Update the state value with the given closure.
The closure takes the current value and returns the new value.
This will silently fail if the state no longer exist (i.e. the component had been unmounted).
This will queue a rerender.
pub fn try_update_with<F: FnOnce(T) -> T>(
&self,
func: F
) -> Result<(), SubtreeUnmountedError>
pub fn try_update_with<F: FnOnce(T) -> T>(
&self,
func: F
) -> Result<(), SubtreeUnmountedError>
Like the update_with
method, but returns result (no silent failure).
Set the state value to the given value.
This will silently fail if the state no longer exist (i.e. the component had been unmounted).
This will queue a rerender.
Like the set_to
method, but returns result (no silent failure).
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Updater<T>
impl<T> !UnwindSafe for Updater<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self