#[non_exhaustive]pub struct CapabilityRequirement {
pub tokens: BTreeSet<String>,
}Expand description
A pre-parsed capability requirement (the “execution requires X” shape).
Thin newtype over a sorted token set — sorted so CSV serialization is
deterministic and log correlation is stable. The Valkey wire form is
the CSV join of this set; the Postgres wire form is the text[]
projection of tokens.
Constructed via CapabilityRequirement::new or parsed from CSV via
CapabilityRequirement::from_csv. The struct is #[non_exhaustive]
— additions (e.g. semver predicates, tier hints) land additively.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tokens: BTreeSet<String>Required tokens. Empty → match any worker.
Implementations§
Source§impl CapabilityRequirement
impl CapabilityRequirement
Sourcepub fn new<I, S>(tokens: I) -> Self
pub fn new<I, S>(tokens: I) -> Self
Build from any iterable of string-like tokens.
Empty strings are dropped (they can’t satisfy anything and would
pollute the CSV form). Duplicates collapse via the BTreeSet.
Sourcepub fn from_csv(csv: &str) -> Self
pub fn from_csv(csv: &str) -> Self
Parse from the Valkey wire form: comma-separated tokens.
Mirrors Lua parse_capability_csv in lua/scheduling.lua:
empty tokens (from ",gpu,,cuda,") are dropped. No validation
of token contents — that’s ingress’s job (see
ff-scheduler::claim and ff-sdk::FlowFabricWorker::connect).
Trait Implementations§
Source§impl Clone for CapabilityRequirement
impl Clone for CapabilityRequirement
Source§fn clone(&self) -> CapabilityRequirement
fn clone(&self) -> CapabilityRequirement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more