pub fn matches(topic: &str, filter: &str) -> boolExpand description
Does topic match filter?
The segmented grammar of docs/PROTOCOL.md §6.4: segments split on .,
* for exactly one whole segment, a trailing # for zero or more, every
other byte literal, and the empty filter matching everything.
The objection this function used to carry was that treating * as a
wildcard “would make topics with a literal * unaddressable and would put
a matching language in the hot path”. Both halves were true and both are
accepted deliberately
(decisions/0007 §4.6): a
filter can no longer select a segment containing ., * or #
literally — there is no escape character, and no sheet reports a use for
one — while a byte prefix could not express a boundary at all, so
sensors.temp also selected sensors.temperature. The hot-path half is
answered by the shape rather than by the choice: # is legal only as the
final segment, so this is one left-to-right walk with no backtracking, no
allocation and work bounded by the 256 B filter cap.
A topic is never a pattern: * and # in a published topic are literal
bytes here, exactly like any other.