Skip to main content

ClusterDescriptor

Struct ClusterDescriptor 

Source
pub struct ClusterDescriptor<'a> {
    pub id: ClusterId,
    pub revision: u16,
    pub feature_map: u32,
    pub attributes: &'a [AttributeDescriptor],
    pub accepted_commands: &'a [CommandDescriptor],
    pub generated_commands: &'a [CommandId],
    pub events: &'a [EventDescriptor],
}
Expand description

What a cluster instance looks like (§7.10).

Static: this is the cluster’s shape, which does not change at runtime. The attribute, command and event slices are expected to be const arrays in flash, and to be sorted by id — ClusterDescriptor::attribute and its siblings binary-search them, and §7.13’s synthesised lists are emitted in that order.

Fields§

§id: ClusterId

The cluster id.

§revision: u16

ClusterRevision (§7.13.1) — “the (highest) revision number of the cluster specification that has been implemented”, and never zero for a cluster defined after the attribute existed.

§feature_map: u32

FeatureMap (§7.13.2). Zero “for a cluster whose definition does not define a FeatureMap”.

§attributes: &'a [AttributeDescriptor]

The attributes this instance serves, excluding the global ones of §7.13, sorted by id.

§accepted_commands: &'a [CommandDescriptor]

The client-to-server commands it accepts, sorted by id.

§generated_commands: &'a [CommandId]

The server-to-client commands it generates that are not responses to an accepted command — most clusters have none, because responses are derived from CommandDescriptor::response.

§events: &'a [EventDescriptor]

The events it may emit, sorted by id.

Implementations§

Source§

impl<'a> ClusterDescriptor<'a>

Source

pub fn attribute(&self, id: AttributeId) -> Option<AttributeDescriptor>

The descriptor for an attribute id, including the global ones of §7.13.

Source

pub fn accepted_command(&self, id: CommandId) -> Option<CommandDescriptor>

The descriptor for an accepted command id.

Source

pub fn event(&self, id: EventId) -> Option<EventDescriptor>

The descriptor for an event id.

Source

pub fn attribute_ids(&self) -> impl Iterator<Item = AttributeId> + 'a

Every attribute id this instance serves, in ascending order: the cluster’s own, then §7.13’s globals.

This is AttributeList’s content. The globals sort last because their ids are 0xFFF8–0xFFFD, above any cluster-specific id.

Source

pub fn generated_command_ids(&self) -> impl Iterator<Item = CommandId> + 'a

Every command id the server may generate: each accepted command’s response, plus any declared outright.

§7.13.5: “For each command in this list that is a response to a client request command, the request command SHALL be indicated in the AcceptedCommandList” — which is exactly the relation this derives from, so the two lists cannot disagree.

Source

pub fn is_well_formed(&self) -> bool

Whether the descriptor is well formed: every slice sorted and free of duplicates, and no attribute claiming an id §7.13 reserves for a global.

A const node cannot be validated at compile time today, so this is what Node::validate calls — once, at start-up, rather than per request. An unsorted slice would make the binary searches silently miss.

Trait Implementations§

Source§

impl<'a> Clone for ClusterDescriptor<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ClusterDescriptor<'a>

Source§

impl<'a> Debug for ClusterDescriptor<'a>

Source§

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

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

impl<'a> Eq for ClusterDescriptor<'a>

Source§

impl<'a> PartialEq for ClusterDescriptor<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for ClusterDescriptor<'a>

Auto Trait Implementations§

§

impl<'a> Forget for ClusterDescriptor<'a>

§

impl<'a> Freeze for ClusterDescriptor<'a>

§

impl<'a> Move for ClusterDescriptor<'a>

§

impl<'a> RefUnwindSafe for ClusterDescriptor<'a>

§

impl<'a> Send for ClusterDescriptor<'a>

§

impl<'a> Sync for ClusterDescriptor<'a>

§

impl<'a> Unpin for ClusterDescriptor<'a>

§

impl<'a> UnsafeUnpin for ClusterDescriptor<'a>

§

impl<'a> UnwindSafe for ClusterDescriptor<'a>

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

Source§

type Output = T

Should always be Self
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 = !

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.