Skip to main content

UserLabel

Struct UserLabel 

Source
pub struct UserLabel<const N: usize> { /* private fields */ }
Expand description

User Label 0x0041 (§9.9): the labels the owner set.

N is a claim this type cannot make good on its own — §9.9.5 says the list survives a reboot, and nothing here writes to storage. UserLabel::labels is what a device persists, and UserLabel::restore is how it comes back.

Implementations§

Source§

impl<const N: usize> UserLabel<N>

Source

pub const fn new() -> Self

A cluster with no labels — a factory-fresh device’s empty list (§9.9.5’s fallback).

Source

pub fn labels(&self) -> Ref<'_, Vec<OwnedLabel, N>>

The labels, for a device about to persist them.

Source

pub fn restore( &self, labels: impl IntoIterator<Item = OwnedLabel>, ) -> Result<(), Status>

Restores the list a device persisted.

Trait Implementations§

Source§

impl<const N: usize> Cluster for UserLabel<N>

Source§

const ID: ClusterId = USER_LABEL_ID

The cluster id this implementation serves.
Source§

impl<const N: usize> ClusterHandler for UserLabel<N>

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 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 data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>

The cluster instance’s data version (§7.10.3), if it tracks one. 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<const N: usize> Debug for UserLabel<N>

Source§

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

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

impl<const N: usize> Default for UserLabel<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const N: usize> !Freeze for UserLabel<N>

§

impl<const N: usize> !RefUnwindSafe for UserLabel<N>

§

impl<const N: usize> !Sync for UserLabel<N>

§

impl<const N: usize> Forget for UserLabel<N>

§

impl<const N: usize> Move for UserLabel<N>

§

impl<const N: usize> Send for UserLabel<N>
where RefCell<VecInner<OwnedLabel, usize, VecStorageInner<[MaybeUninit<OwnedLabel>; N]>>>: Send,

§

impl<const N: usize> Unpin for UserLabel<N>
where RefCell<VecInner<OwnedLabel, usize, VecStorageInner<[MaybeUninit<OwnedLabel>; N]>>>: Unpin,

§

impl<const N: usize> UnsafeUnpin for UserLabel<N>

§

impl<const N: usize> UnwindSafe for UserLabel<N>

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.