matter_controller/fabric_info.rs
1//! Typed, snapshot-decoupled view of a fabric ([`MatterController::fabrics`]).
2
3/// Metadata about a fabric the controller has created.
4///
5/// Returned by [`MatterController::fabrics`](crate::MatterController::fabrics)
6/// so callers can check which fabrics already exist — in particular, before
7/// calling [`MatterController::create_fabric`](crate::MatterController::create_fabric)
8/// on every startup. Since issue #110, `create_fabric` refuses to create a
9/// second fabric with a `fabric_id` already present and returns
10/// [`Error::FabricAlreadyExists`](crate::Error::FabricAlreadyExists) instead
11/// of silently duplicating it; `fabrics()` is how a caller checks first.
12///
13/// `#[non_exhaustive]`: more fields may be added without a breaking change.
14#[derive(Clone, Debug, PartialEq, Eq)]
15#[non_exhaustive]
16pub struct FabricInfo {
17 /// Matter fabric identifier (spec §6.2.1).
18 pub fabric_id: u64,
19 /// The stable node ID the controller itself takes on this fabric — its
20 /// own commissioner operational identity, minted once by
21 /// [`crate::MatterController::create_fabric`] and reused for every CASE
22 /// handshake on this fabric.
23 pub commissioner_node_id: u64,
24 /// Number of devices currently commissioned onto this fabric.
25 pub node_count: usize,
26 /// Whether this fabric uses a 3-tier RCAC->ICAC->NOC chain (`true`) or
27 /// issues NOCs directly under the RCAC (`false`, the default from
28 /// [`crate::FabricConfig::new`]).
29 pub icac_enabled: bool,
30}