Skip to main content

Groups

Struct Groups 

Source
pub struct Groups<'a, const N: usize, I: Identifying = NeverIdentifying, S: ScenePurge = NoScenes> { /* private fields */ }
Expand description

The Groups cluster’s table.

N is the total across every fabric. §1.3 gives no minimum, but a device type usually does, and per_fabric is what stops the first ecosystem to commission filling the table and leaving the second unable to make a single group.

Implementations§

Source§

impl<const N: usize> Groups<'static, N, NeverIdentifying, NoScenes>

Source

pub const fn new(per_fabric: usize, names: bool) -> Self

A table for an endpoint with neither an Identify nor a Scenes Management cluster.

Source§

impl<'a, const N: usize, I: Identifying, S: ScenePurge> Groups<'a, N, I, S>

Source

pub const fn with( per_fabric: usize, names: bool, identifying: &'a I, scenes: &'a S, ) -> Self

A table for an endpoint whose Identify cluster identifying reports and whose scenes live in scenes.

Both are what the rest of the endpoint contributes: §1.3.7.6 makes AddGroupIfIdentifying conditional on Identify, and §1.3.7.4 makes RemoveGroup remove that group’s scenes. Pass NeverIdentifying or NoScenes for an endpoint that has neither — they compile to nothing.

Source

pub fn conforming( feature_map: u32, optional: &Optional<'_>, ) -> Result<Conforming<1, 6, 4, 0>>

The descriptor for an instance, derived from the specification’s tables.

Source

pub fn name_support(&self) -> NameSupportBitmap

NameSupport (§1.3.6.1).

“The most significant bit, bit 7 (GroupNames), SHALL be equal to bit 0 of the FeatureMap attribute (GN Feature). All other bits SHALL be 0.” A legacy view of one feature bit, kept in step here so the two cannot disagree.

Source

pub const fn feature_map(&self) -> u32

The FeatureMap this instance should declare.

Source

pub fn memberships(&self) -> Ref<'_, Vec<Membership, N>>

Every membership, for a device about to persist them.

Source

pub fn is_member(&self, fabric: FabricIndex, group: GroupId) -> bool

Whether the endpoint is in a group, on a fabric.

Source

pub fn len_of_fabric(&self, fabric: FabricIndex) -> usize

How many groups one fabric holds on this endpoint.

Source

pub fn capacity(&self, fabric: FabricIndex) -> u8

§1.3.7.9.1’s Capacity: how many more groups this fabric may add.

Source

pub fn remove_fabric(&self, fabric: FabricIndex)

Removes every membership of one fabric — what RemoveFabric must do.

The fabric’s scenes go with them: §1.4.6 says “Upon leaving a fabric with the RemoveFabric command … all scenes data for the associated fabric SHALL be removed”, and a group’s scenes outliving the group is the same leak RemoveGroup avoids.

Trait Implementations§

Source§

impl<const N: usize, I: Identifying, S: ScenePurge> Cluster for Groups<'_, N, I, S>

So a tuple of clusters can dispatch to it by id.

Source§

const ID: ClusterId = ID

The cluster id this implementation serves.
Source§

impl<const N: usize, I: Identifying, S: ScenePurge> ClusterHandler for Groups<'_, N, I, S>

Source§

fn on_lifecycle(&self, event: Lifecycle)

§1.3: group membership is fabric-scoped, and §1.3.7.4’s rule that a group’s scenes go with the group applies here too — remove_fabric takes both.

Source§

fn read( &self, resolved: &Resolved<'_>, _ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<(), Status>

Writes the value of resolved’s attribute under tag. Read more
Source§

fn invoke( &self, resolved: &ResolvedCommand<'_>, fields: Option<&[u8]>, ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<Option<CommandId>, StatusIb>

Runs a command. Read more
Source§

fn data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>

The cluster instance’s data version (§7.10.3), if it tracks one. Read more
Source§

fn write( &self, _resolved: &Resolved<'_>, _data: &[u8], _op: WriteOp, _ctx: &InteractionContext<'_>, ) -> Result<(), Status>

Writes data — the encoded TLV element, tag included — into the attribute. Read more
Source§

impl<'a, const N: usize, I: Debug + Identifying, S: Debug + ScenePurge> Debug for Groups<'a, N, I, S>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, I: Identifying, S: ScenePurge> GroupMembership for Groups<'_, N, I, S>

Source§

fn is_group_member(&self, fabric: FabricIndex, group: GroupId) -> bool

Whether the endpoint is in group on fabric.

Auto Trait Implementations§

§

impl<'a, const N: usize, I = NeverIdentifying, S = NoScenes> !Freeze for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I = NeverIdentifying, S = NoScenes> !RefUnwindSafe for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I = NeverIdentifying, S = NoScenes> !Sync for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> Forget for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> Move for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> Send for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> Unpin for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> UnsafeUnpin for Groups<'a, N, I, S>

§

impl<'a, const N: usize, I, S> UnwindSafe for Groups<'a, N, I, S>

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.