Enum Anchor
pub enum Anchor {
Unset,
First,
Middle,
Head,
BeyondHead,
}proptest only.Expand description
A position named by description rather than by value.
The generator emits these; the runner resolves one into a real
SequencePosition against the log the store has built so far. See the
module documentation for why a generated literal would be meaningless.
The runbook spells the first variant None. It is Unset here so that a
match arm cannot be read as Option::None — the resolution of every
variant is an Option, and two Nones in one match are one mistake away
from each other.
Variants§
Unset
No position at all: an unbounded read, or a condition over the whole log.
First
The lowest position the store has assigned.
Middle
A position in the middle of the assigned range.
It coincides with the neighbouring anchors on short logs, and a
shrunk counterexample is exactly where short logs live, so the next
reader needs to know before they go looking at the wrong half of their
adapter. Resolution is positions[len / 2], so Middle is Head at
len == 2 and is both First and Head at len == 1; a strictly
interior position only exists from three events up.
Biasing the index down — (len - 1) / 2 — was considered and rejected:
it only moves the collapse at len == 2 from Head to First, which is
no less misleading, and it perturbs the deterministic generator that the
proof artefact’s per-store coverage claims are pinned against. Naming the
coincidence costs nothing and is honest at every length.
Head
The highest position the store has assigned.
BeyondHead
A position the store has not assigned, above everything it has.