#[non_exhaustive]pub struct CapabilityMatrix {
pub identity: BackendIdentity,
pub caps: BTreeMap<Capability, CapabilityStatus>,
}Expand description
Full capability snapshot for a backend: its BackendIdentity
plus a stable-ordered map of Capability → CapabilityStatus.
BTreeMap (not HashMap) so iteration order is deterministic —
ff-server’s JSON response is byte-stable, cairn’s operator UI
can render rows in a fixed order, and tests comparing matrices
across runs do not race on hash randomization.
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.identity: BackendIdentityBackend identity tuple this matrix was assembled for.
caps: BTreeMap<Capability, CapabilityStatus>Per-capability status. Absent capabilities are treated as
CapabilityStatus::Unknown by Self::get.
Implementations§
Source§impl CapabilityMatrix
impl CapabilityMatrix
Sourcepub fn new(identity: BackendIdentity) -> Self
pub fn new(identity: BackendIdentity) -> Self
Build an empty matrix tagged with the given backend identity.
Backends populate rows via Self::set before returning the
matrix from capabilities_matrix().
Sourcepub fn set(&mut self, cap: Capability, status: CapabilityStatus) -> &mut Self
pub fn set(&mut self, cap: Capability, status: CapabilityStatus) -> &mut Self
Record the status for one capability. Returns &mut self
so backends can chain setup in a builder-style declaration.
Sourcepub fn get(&self, cap: Capability) -> CapabilityStatus
pub fn get(&self, cap: Capability) -> CapabilityStatus
Look up one capability’s status. Absent rows return
CapabilityStatus::Unknown — callers that need to
distinguish “absent” from “explicitly marked unknown” must
consult self.caps directly.
Sourcepub fn supports(&self, cap: Capability) -> bool
pub fn supports(&self, cap: Capability) -> bool
Convenience predicate: the capability is
CapabilityStatus::Supported or CapabilityStatus::Partial.
Both map to “you can call the trait method and it will work
(possibly with a caveat)”; Unsupported and Unknown both
map to “don’t dispatch, or be ready to catch Unavailable.”
Trait Implementations§
Source§impl Clone for CapabilityMatrix
impl Clone for CapabilityMatrix
Source§fn clone(&self) -> CapabilityMatrix
fn clone(&self) -> CapabilityMatrix
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more