Trait hooks_core::HookPollNextUpdate
source · pub trait HookPollNextUpdate {
// Required method
fn poll_next_update(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<bool>;
}Expand description
Defines reactivity of a hook.
See poll_next_update() for details.
Required Methods§
sourcefn poll_next_update(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<bool>
fn poll_next_update(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<bool>
The meaning of the return value is:
-
Poll::Pendingmeans this hook’s inner state is not updated after the lastuse_hook. The executor DO NOT NEED to calluse_hookagain because the returned value is expected to remain the same as the value from the last call. The executor CAN still calluse_hookto re-get the returned value. -
Poll::Ready(true)means this hook’s inner state has been updated since the lastuse_hook. The executor SHOULD calluse_hookagain to get the new value. If the executor doesn’t update or use this hook, instead, it polls the hook again, the hook may still returnPoll::Ready(true). -
Poll::Ready(false)means this hook’s inner state will never be updated. The executor CAN drop this hook. The executor CAN calluse_hookto get the value or update it, and the hook MIGHT become dynamic again duringuse_hookorupdate_hook, or when some operations is done to the returned value.