コンテンツにスキップ

RootSet

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

Defined in: root.rs:441

pub struct RootSet\<'a, Y\>

The root events of a walk, with the state each one carries between steps.

Built once and handed to advance_to_roots for every target, so the guards survive a resumption: a non-terminal root leaves the state on its boundary, and the guard is what keeps the next step from reporting the departure as a new crossing.

fn new(events: &‘a [&‘a dyn RootEvent<Y>], slots: &‘a mut [RootSlot], search: RootSearch) -> [Result<Self, IntegrationError>](https://doc.rust-lang.org/std/result/enum.Result.html)

Pair events with the slots that carry their search state.

The slots start as RootSlot::new and stay with the caller, which is what lets the number of events be whatever the caller’s model has. Each event’s boundary tolerance is read here and not again.


fn hits(&self) -> impl [Iterator<Item = RootHit>](https://doc.rust-lang.org/std/iter/traits/iterator/trait.Iterator.html) + ’_

The events that crossed within the bracket the last walk ended on, in the order they should be handled: by priority, then by registration.

Empty after a walk that reached its target. The iterator borrows the set, so a caller that switches events off while handling the roots reads them one at a time with hit_at(Self::hit_at) instead.


fn hit_count(&self) -> usize

How many events crossed within that bracket.


fn hit_at(&self, rank: usize) -> [Option<RootHit>](https://doc.rust-lang.org/std/option/enum.Option.html)

The root to handle rankth, counting from the one to handle first.

Switching events on or off leaves these alone: they describe a boundary the walk has already committed to.


fn guard(&self, event: usize) -> RootGuard

One event’s guard, for a caller checking whether the state is sitting on that boundary.


fn len(&self) -> usize

How many events are in the set, switched on or off.


fn is_empty(&self) -> bool

Whether the set has no events, in which case a walk over it is the plain one.


fn is_active(&self, event: usize) -> bool

Whether the search looks at this event.


fn activate(&mut self, event: usize)

Start looking at this event again, with a fresh guard.

The guard is re-armed because the value has been unobserved: the side it was last seen on says nothing about where it is now. The next walk reads the value at its own start, and a crossing that happened while the event was switched off is not reported. An event that is already on is left alone, guard included.

Switch events while the walk is not running — between the calls to advance_to_roots — so that the value each event is compared against is the one read at a step’s start.


fn deactivate(&mut self, event: usize)

Stop looking at this event.

Its value is not evaluated while it is off, so an event whose meaning depends on a mode — the release of a constraint that is not held — costs nothing in the modes where it says nothing.