Skip to main content

CapabilityMatrix

Struct CapabilityMatrix 

Source
#[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 CapabilityCapabilityStatus.

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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§identity: BackendIdentity

Backend 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

Source

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().

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> CapabilityMatrix

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CapabilityMatrix

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.