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>
impl<const N: usize> UserLabel<N>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
A cluster with no labels — a factory-fresh device’s empty list (§9.9.5’s fallback).
Sourcepub fn labels(&self) -> Ref<'_, Vec<OwnedLabel, N>>
pub fn labels(&self) -> Ref<'_, Vec<OwnedLabel, N>>
The labels, for a device about to persist them.
Sourcepub fn restore(
&self,
labels: impl IntoIterator<Item = OwnedLabel>,
) -> Result<(), Status>
pub fn restore( &self, labels: impl IntoIterator<Item = OwnedLabel>, ) -> Result<(), Status>
Restores the list a device persisted.
Trait Implementations§
Source§impl<const N: usize> ClusterHandler for UserLabel<N>
impl<const N: usize> ClusterHandler for UserLabel<N>
Source§fn read(
&self,
resolved: &Resolved<'_>,
_ctx: &InteractionContext<'_>,
w: &mut TlvWriter<'_>,
tag: Tag,
) -> Result<(), Status>
fn read( &self, resolved: &Resolved<'_>, _ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<(), Status>
Source§fn write(
&self,
resolved: &Resolved<'_>,
data: &[u8],
op: WriteOp,
_ctx: &InteractionContext<'_>,
) -> Result<(), Status>
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 moreSource§fn data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>
fn data_version(&self, _resolved: &Resolved<'_>) -> Option<u32>
The cluster instance’s data version (§7.10.3), if it tracks one. 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>
impl<const N: usize> Unpin for UserLabel<N>
impl<const N: usize> UnsafeUnpin for UserLabel<N>where
RefCell<VecInner<OwnedLabel, usize, VecStorageInner<[MaybeUninit<OwnedLabel>; N]>>>: UnsafeUnpin,
impl<const N: usize> UnwindSafe for UserLabel<N>where
RefCell<VecInner<OwnedLabel, usize, VecStorageInner<[MaybeUninit<OwnedLabel>; N]>>>: UnwindSafe,
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
Mutably borrows from an owned value. Read more