pub struct Binding<C: Config, const N: usize> { /* private fields */ }Expand description
The Binding cluster’s table (§9.6.6.1).
N is the total across every fabric; §9.6.1 asks that a device type’s minimum be available
“for each fabric the node supports”, which is what Binding::per_fabric enforces.
Implementations§
Source§impl<C: Config, const N: usize> Binding<C, N>
impl<C: Config, const N: usize> Binding<C, N>
Sourcepub const fn new(per_fabric: usize) -> Self
pub const fn new(per_fabric: usize) -> Self
A table with no bindings — §9.6.6’s fallback of [].
per_fabric is how many entries any one fabric may hold, so that the first fabric to
fill the table cannot leave a later one unable to bind anything.
Sourcepub const fn per_fabric(&self) -> usize
pub const fn per_fabric(&self) -> usize
The per-fabric quota.
Sourcepub fn targets(&self) -> Ref<'_, Vec<Target, N>>
pub fn targets(&self) -> Ref<'_, Vec<Target, N>>
Every binding, for a device about to persist them.
Sourcepub fn len_of_fabric(&self, fabric: FabricIndex) -> usize
pub fn len_of_fabric(&self, fabric: FabricIndex) -> usize
How many bindings one fabric holds.
Sourcepub fn add(&self, target: Target) -> Result<(), Status>
pub fn add(&self, target: Target) -> Result<(), Status>
Adds one binding.
§9.6.1: “If, during the creation of multiple bindings, there are no available resources to create an entry … the client SHALL respond with a status of RESOURCE_EXHAUSTED, and the binding SHALL NOT be created.”
Sourcepub fn remove_fabric(&self, fabric: FabricIndex)
pub fn remove_fabric(&self, fabric: FabricIndex)
Removes every binding of one fabric — what RemoveFabric must do.
§9.6.1: “When a binding is removed, the client endpoint SHALL end the binding relationship with the removed binding target.” Ending it is the application’s; this is the table’s half.
Trait Implementations§
Source§impl<C: Config, const N: usize> ClusterHandler for Binding<C, N>
impl<C: Config, const N: usize> ClusterHandler for Binding<C, N>
Source§fn on_lifecycle(&self, event: Lifecycle)
fn on_lifecycle(&self, event: Lifecycle)
§9.6: the Binding table is fabric-scoped (F), so a removed fabric’s targets go with
it — otherwise this node keeps trying to reach a peer on a fabric it has left.
Source§fn read(
&self,
resolved: &Resolved<'_>,
ctx: &InteractionContext<'_>,
w: &mut TlvWriter<'_>,
tag: Tag,
) -> Result<(), Status>
fn read( &self, resolved: &Resolved<'_>, ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<(), Status>
Source§fn write(
&self,
resolved: &Resolved<'_>,
data: &[u8],
op: WriteOp,
ctx: &InteractionContext<'_>,
) -> Result<(), Status>
fn write( &self, resolved: &Resolved<'_>, data: &[u8], op: WriteOp, ctx: &InteractionContext<'_>, ) -> Result<(), Status>
data — the encoded TLV element, tag included — into the attribute. Read more