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::Pending
means this hook’s inner state is not updated after the lastuse_hook
. The executor DO NOT NEED to calluse_hook
again because the returned value is expected to remain the same as the value from the last call. The executor CAN still calluse_hook
to 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_hook
again 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_hook
to get the value or update it, and the hook MIGHT become dynamic again duringuse_hook
orupdate_hook
, or when some operations is done to the returned value.