コンテンツにスキップ

RootGuard

このコンテンツはまだ日本語訳がありません。

Defined in: root.rs:237

pub struct RootGuard

What one event knows between steps, and across resumptions.

Two things keep a root from being found again, because the state a root leaves behind is not exactly on the boundary — the search stops on the far side of a bracket, so the value there is a small non-zero rather than zero:

  • the time the root was reported, together with the value the root left behind. A step that starts at that time with the value still on that side is the one leaving the root, and it does not report the same event again. Both comparisons are exact and need no tolerance. A caller that moves the value to a different side from the one left there — or to either side, where the root landed exactly on zero — and clear of the event’s boundary_tolerance(RootEvent::boundary_tolerance), has moved the state off that root, so the step it then takes reports a crossing as any other would.
  • whether the value is still within the event’s boundary_tolerance(RootEvent::boundary_tolerance), for a state that goes on moving along the boundary over many steps.

const fn new() -> Self

A guard for an event no root has fired on yet.


fn at(&self) -> Option<f64>

The time of the root this event last reported, if the walk is still standing on it.


fn is_on_boundary(&self) -> bool

Whether this event is suppressed because the state is on its boundary.