pub struct Cluster<'a> {
pub id: u32,
pub revision: u16,
pub feature_map: u32,
pub attributes: &'a [Attribute],
pub commands: &'a [Command],
pub events: &'a [Event],
pub with_attrs: fn(&Attribute, u16, u32) -> bool,
pub with_cmds: fn(&Command, u16, u32) -> bool,
pub with_events: fn(&Event, u16, u32) -> bool,
}Expand description
A struct modeling the cluster meta-data (i.e. what is the cluster ID, revision, features, attributes and their access, commands and their access) in the Matter data model.
Fields§
§id: u32The ID of the cluster
revision: u16The revision of the cluster
feature_map: u32The feature map of the cluster
attributes: &'a [Attribute]The attributes of the cluster.
These could be all attributes as specified in the Matter spec,
even if the concrete instantiation of the cluster supports only a subset of these.
See with_attrs for more details.
commands: &'a [Command]The commands of the cluster.
These could be all commands as specified in the Matter spec,
even if the concrete instantiation of the cluster supports only a subset of these.
See with_cmds for more details.
events: &'a [Event]The events of the cluster.
These could be all events as specified in the Matter spec,
even if the concrete instantiation of the cluster supports only a subset of these.
See with_events for more details.
with_attrs: fn(&Attribute, u16, u32) -> boolA function that takes an attribute and returns a boolean indicating if the attribute is supported by the cluster.
with_cmds: fn(&Command, u16, u32) -> boolA function that takes a command and returns a boolean indicating if the command is supported by the cluster.
with_events: fn(&Event, u16, u32) -> boolA function that takes an event and returns a boolean indicating if the event is supported by the cluster.
Implementations§
Source§impl<'a> Cluster<'a>
impl<'a> Cluster<'a>
Sourcepub const fn new(
id: u32,
revision: u16,
feature_map: u32,
attributes: &'a [Attribute],
commands: &'a [Command],
events: &'a [Event],
with_attrs: fn(&Attribute, u16, u32) -> bool,
with_cmds: fn(&Command, u16, u32) -> bool,
with_events: fn(&Event, u16, u32) -> bool,
) -> Cluster<'a>
pub const fn new( id: u32, revision: u16, feature_map: u32, attributes: &'a [Attribute], commands: &'a [Command], events: &'a [Event], with_attrs: fn(&Attribute, u16, u32) -> bool, with_cmds: fn(&Command, u16, u32) -> bool, with_events: fn(&Event, u16, u32) -> bool, ) -> Cluster<'a>
Create a new cluster
§Arguments
id: The ID of the clusterrevision: The revision of the clusterfeature_map: The feature map of the clusterattributes: The attributes of the clustercommands: The commands of the clusterwith_attrs: A function that takes an attribute and returns a boolean indicating if the attribute should be includedwith_cmds: A function that takes a command and returns a boolean indicating if the command should be includedwith_events: A function that takes an event and returns a boolean indicating if the event should be included
Sourcepub const fn with_revision(self, revision: u16) -> Cluster<'a>
pub const fn with_revision(self, revision: u16) -> Cluster<'a>
Return a new cluster with a modified revision
Sourcepub const fn with_features(self, feature_map: u32) -> Cluster<'a>
pub const fn with_features(self, feature_map: u32) -> Cluster<'a>
Return a new cluster with a modified feature map
Sourcepub const fn with_attrs(
self,
with_attrs: fn(&Attribute, u16, u32) -> bool,
) -> Cluster<'a>
pub const fn with_attrs( self, with_attrs: fn(&Attribute, u16, u32) -> bool, ) -> Cluster<'a>
Return a new cluster with a modified attributes’ matcher
Sourcepub const fn with_cmds(
self,
with_cmds: fn(&Command, u16, u32) -> bool,
) -> Cluster<'a>
pub const fn with_cmds( self, with_cmds: fn(&Command, u16, u32) -> bool, ) -> Cluster<'a>
Return a new cluster with a modified commands’ matcher
Sourcepub const fn with_events(
self,
with_events: fn(&Event, u16, u32) -> bool,
) -> Cluster<'a>
pub const fn with_events( self, with_events: fn(&Event, u16, u32) -> bool, ) -> Cluster<'a>
Return a new cluster with a modified events’ matcher
Sourcepub fn attribute(&self, id: u32) -> Option<&Attribute>
pub fn attribute(&self, id: u32) -> Option<&Attribute>
Return a reference to the attribute with the given ID, if it exists.
Sourcepub fn command(&self, id: u32) -> Option<&Command>
pub fn command(&self, id: u32) -> Option<&Command>
Return a reference to the command with the given ID, if it exists.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Cluster<'a>
impl<'a> RefUnwindSafe for Cluster<'a>
impl<'a> Send for Cluster<'a>
impl<'a> Sync for Cluster<'a>
impl<'a> Unpin for Cluster<'a>
impl<'a> UnsafeUnpin for Cluster<'a>
impl<'a> UnwindSafe for Cluster<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more