pub enum TagMatcher {
Exact {
value: String,
},
Prefix {
value: String,
},
Axis {
axis: TaxonomyAxis,
},
AxisKey {
axis: TaxonomyAxis,
key: String,
},
Regex {
pattern: String,
},
VersionRange {
axis_key: String,
min: Option<String>,
max: Option<String>,
},
}Expand description
Pre-grouping filter — picks which entries the aggregation walks.
Applied against each entry’s tags array; an entry is included if
ANY of its tags matches the matcher. The 6c-A scope covers the
four variants that don’t pull in regex or semver dependencies.
Variants§
Exact
Exact tag string match — e.g. "software.python=3.11" matches
only entries carrying that exact canonical tag.
Prefix
Tag-string prefix — e.g. "hardware.gpu" matches
"hardware.gpu" and "hardware.gpu.vram_gb=80" and any other
tag starting with the prefix.
Axis
Tag is anywhere in the given taxonomy axis. Matches every axis-prefixed tag (presence + value) in that axis.
Fields
axis: TaxonomyAxisTaxonomy axis the tag must live in.
AxisKey
Tag has a specific (axis, key) regardless of value.
AxisKey { axis: Hardware, key: "gpu.count" } matches
"hardware.gpu.count=8" and "hardware.gpu.count=16" but not
"hardware.gpu.vram_gb=80".
Fields
axis: TaxonomyAxisTaxonomy axis the tag must live in.
Regex
Regex match against the canonical tag string form. Invalid
patterns reject everything (the matcher fails closed —
safer than silently treating bad patterns as wildcards).
Compiled per matches_one call; callers expecting heavy
reuse should pre-filter via a coarser matcher first.
Feature-gated. Requires the regex Cargo feature on the
receiving binary. The variant is part of the wire format
unconditionally (so peers can exchange it), but a binary built
without regex cannot evaluate it. Callers that accept
user-supplied matchers should call TagMatcher::validate
first to surface TagMatcherError::RegexNotBuiltIn
explicitly; passing an unvalidated Regex matcher into
Fold::aggregate / Fold::capacity_ranking on a
regex-less binary panics with a build-time-config message.
VersionRange
Semver range against a specific axis-key value. Picks
AxisValue tags whose (axis, key) matches axis_key
(canonical dotted form, e.g. "software.python") and whose
value parses as a semver Version within
[min, max] (inclusive). min/max are
Option<String> semver expressions — None means
unbounded on that side. Unparseable values are skipped
silently.
Implementations§
Source§impl TagMatcher
impl TagMatcher
Sourcepub fn validate(&self) -> Result<(), TagMatcherError>
pub fn validate(&self) -> Result<(), TagMatcherError>
Verify this matcher can be evaluated by the current binary’s
feature set. Callers that accept user-supplied matchers
(RPC handlers, language-binding constructors, CLI parsers)
should call this BEFORE handing the matcher to
Fold::aggregate / Fold::capacity_ranking so an
unsupported variant surfaces as a structured error instead
of a panic on first compile.
Returns Ok(()) for every variant the build supports.
Returns Err(TagMatcherError::RegexNotBuiltIn { .. }) only
when the matcher is Self::Regex and the binary was built
without --features regex.
Sourcepub fn matches_any(&self, tags: &[String]) -> bool
pub fn matches_any(&self, tags: &[String]) -> bool
True if at least one element of tags matches this matcher.
Same semantic the aggregation entry points use — exposed as a
public method so off-fold callers (e.g.
super::super::super::MeshNode::list_tools)
can apply the same pre-grouping filter without re-implementing
the variant dispatch.
Compiles on every call. Callers that need to evaluate a
large entry set against the same matcher should keep the
[Fold::aggregate] path, which compiles once and reuses
across the walk. list_tools accepts the per-call compile
cost because the fold size is small relative to the
aggregation paths’ hot loops.
Panics if self is Self::Regex and the binary was
built without the regex Cargo feature; same contract as
Fold::aggregate. Call Self::validate up front if the
matcher came from an untrusted source.
Trait Implementations§
Source§impl Clone for TagMatcher
impl Clone for TagMatcher
Source§fn clone(&self) -> TagMatcher
fn clone(&self) -> TagMatcher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TagMatcher
impl Debug for TagMatcher
Source§impl<'de> Deserialize<'de> for TagMatcher
impl<'de> Deserialize<'de> for TagMatcher
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TagMatcher, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TagMatcher, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for TagMatcher
Source§impl PartialEq for TagMatcher
impl PartialEq for TagMatcher
Source§fn eq(&self, other: &TagMatcher) -> bool
fn eq(&self, other: &TagMatcher) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TagMatcher
impl Serialize for TagMatcher
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TagMatcher
Auto Trait Implementations§
impl Freeze for TagMatcher
impl RefUnwindSafe for TagMatcher
impl Send for TagMatcher
impl Sync for TagMatcher
impl Unpin for TagMatcher
impl UnsafeUnpin for TagMatcher
impl UnwindSafe for TagMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.