pub struct HookContext { /* private fields */ }Expand description
Manages hook state across render cycles for a DynamicNode.
Stores boxed Any values keyed by hook call order, enabling use_signal
and similar hooks to persist state between re-renders of the same
dynamic node.
Implements Clone for ergonomic use; all clones share the same underlying state.
Implementations§
Source§impl HookContext
Implementation of hook context lifecycle and hook index management.
impl HookContext
Implementation of hook context lifecycle and hook index management.
Sourcepub fn reset_hook_index(&mut self)
pub fn reset_hook_index(&mut self)
Resets the hook index for a new render cycle.
Sets the internal hook index back to zero so that subsequent
use_signal calls start indexing from the beginning of the hook list.
Sourcepub fn set_arm_changed(&mut self, changed: usize)
pub fn set_arm_changed(&mut self, changed: usize)
Notifies the hook context that a match arm is being entered.
If the arm index has changed, all existing hooks and cleanups are cleared and re-initialized for the new arm. If the arm is unchanged, only the hook index is reset.
§Arguments
usize: The index of the new match arm.
Source§impl HookContext
impl HookContext
pub fn get_mut_inner(&mut self) -> &mut Rc<RefCell<HookContextInner>>
Trait Implementations§
Source§impl Clone for HookContext
Clones the hook context, sharing the same inner state.
impl Clone for HookContext
Clones the hook context, sharing the same inner state.