pub(crate) enum Class {
Rule(usize),
Default,
Unshapeable,
}Expand description
Which row of ShapeStats a unit is charged to.
Copy, and an index rather than a name: the storage is a pre-sized
Vec<ClassCounters> in configured order, so charging a unit is one
relaxed fetch_add at a known offset and never a map lookup.
Variants§
Rule(usize)
The rule at this index in ShapeProfile::classes.
Default
No rule claimed the unit.
This is the falsifiable signal that a rule did not fire: an author
who expected a class to claim everything and reads
ShapeStats::default_class.objects_delivered > 0 knows their rule
did not fire, and the ShapeRuleUnmatchable impairment says why.
objects_delivered, not objects_dropped — the counter this
doc used to name has a producer only under Overflow::DropTail,
so under the default Overflow::Block it is permanently zero and
an author following the instruction would read a zero and conclude
their rule had fired. objects_delivered has a producer under every
overflow policy. (The drop row is still the right one to read in a
DropTail fixture, which is why
a_datagram_rule_says_so_instead_of_matching_nothing asserts it.)
Unshapeable
There was nothing to classify: a subgroup stream header, an oversized
object the framer could only pass through, a bypassed stream’s bytes.
Such a unit still takes an ordering slot — it is bytes on a wire
that has other bytes queued in front of it — but it charges no bucket,
because no rule can name what no ObjectMeta describes. Distinct from
Self::Default, which is a unit the rules did see and none of them
claimed: conflating them would let my rule matched nothing and there
was nothing for a rule to match report as one number.