Skip to main content

Descriptor

Struct Descriptor 

Source
pub struct Descriptor<'a> {
    pub node: Node<'a>,
    pub endpoint: EndpointId,
    pub parts: &'a [EndpointId],
    pub tags: &'a [SemanticTag<'a>],
    pub unique_id: Option<&'a str>,
}
Expand description

The Descriptor cluster on one endpoint.

Borrows the Node rather than copying anything out of it: ServerList and ClientList are views of the endpoint’s own cluster set, and the whole point is that they cannot disagree with it.

One instance per endpoint, because §9.5 is scoped to an endpoint — Descriptor::endpoint is the endpoint it answers for, and a read of any other endpoint’s Descriptor is a different instance.

Fields§

§node: Node<'a>

The node this endpoint belongs to — the source of ServerList.

§endpoint: EndpointId

The endpoint this instance is on.

§parts: &'a [EndpointId]

PartsList (§9.5.6.4) — the endpoints this one is composed of.

§tags: &'a [SemanticTag<'a>]

TagList (§9.5.6.5), when the instance declares TAGLIST.

§unique_id: Option<&'a str>

EndpointUniqueID (§9.5.6.6), when the instance serves it.

Implementations§

Source§

impl<'a> Descriptor<'a>

Source

pub const fn new(node: Node<'a>, endpoint: EndpointId) -> Self

A Descriptor for an endpoint, with nothing composed under it.

DeviceTypeList is not a parameter: §9.5.6.1’s list is the endpoint’s own, and it is read from the node. Passing it separately would let a Descriptor publish device types that the endpoint it names does not have — and §6.6.6.2’s access control matches ACL targets against the endpoint’s, so the two disagreeing is a privilege decision made on one list and reported from another.

Source

pub fn device_types(&self) -> &'a [DeviceType]

The device types of the endpoint this instance answers for (§9.5.6.1).

Source

pub fn clients(&self) -> &'a [ClusterId]

The clusters the endpoint speaks as a client (§9.5.6.3).

Read from the node for the same reason DeviceTypeList is: a Descriptor that carried its own copy could publish a ClientList the endpoint it names does not have, and §9.2’s device-type check reads the endpoint’s.

Source

pub const fn with_parts(self, parts: &'a [EndpointId]) -> Self

The same instance with a PartsList.

Source

pub const fn with_tags(self, tags: &'a [SemanticTag<'a>]) -> Self

The same instance with a TagList — requires the TAGLIST feature.

Source

pub const fn with_unique_id(self, unique_id: &'a str) -> Self

The same instance with an EndpointUniqueID.

Source

pub fn descriptor(&self) -> ClusterDescriptor<'static>

The cluster descriptor matching what this instance serves.

TagList and EndpointUniqueID are in the list exactly when this instance has them, because §7.13.3’s AttributeList is what a commissioner builds its model from — an entry for an attribute that answers UNSUPPORTED_ATTRIBUTE is a certification failure, and so is a served attribute missing from the list.

Trait Implementations§

Source§

impl<'a> Clone for Descriptor<'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 Cluster for Descriptor<'_>

Source§

const ID: ClusterId = ID

The cluster id this implementation serves.
Source§

impl ClusterHandler for Descriptor<'_>

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 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§

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 on_lifecycle(&self, _event: Lifecycle)

Reacts to something that happened to the node (see Lifecycle). Read more
Source§

impl<'a> Copy for Descriptor<'a>

Source§

impl<'a> Debug for Descriptor<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Descriptor<'a>

§

impl<'a> Freeze for Descriptor<'a>

§

impl<'a> Move for Descriptor<'a>

§

impl<'a> RefUnwindSafe for Descriptor<'a>

§

impl<'a> Send for Descriptor<'a>

§

impl<'a> Sync for Descriptor<'a>

§

impl<'a> Unpin for Descriptor<'a>

§

impl<'a> UnsafeUnpin for Descriptor<'a>

§

impl<'a> UnwindSafe for Descriptor<'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.