pub struct Handle<K: Kind> { /* private fields */ }Expand description
A generational index naming one object of kind K.
index is the arena slot (at most Handle::MAX_INDEX); generation
is the slot’s generation at creation, and is never zero for a live
handle — generation 0 is Handle::NULL, the C kernel’s NULL handle.
Implementations§
Source§impl<K: Kind> Handle<K>
impl<K: Kind> Handle<K>
Sourcepub const NULL: Self
pub const NULL: Self
The null handle: names nothing, resolves to
Error::InvalidHandle. What NULL means to xTaskGetHandle.
Sourcepub const fn from_parts(index: u16, generation: u16) -> Self
pub const fn from_parts(index: u16, generation: u16) -> Self
A handle for index at generation. The arena is the only intended
caller; a generation of zero yields the null handle.
Sourcepub const fn generation(self) -> u16
pub const fn generation(self) -> u16
The slot generation this handle was minted at (zero for the null handle).
Sourcepub const fn to_raw(self) -> u32
pub const fn to_raw(self) -> u32
The handle as one u32 for the C ABI: generation in the high half,
index in the low half. The null handle is 0, exactly NULL.
Sourcepub const fn from_raw(raw: u32) -> Self
pub const fn from_raw(raw: u32) -> Self
A handle from its C-ABI form. Never fails: a zero is the null handle, anything else is checked by the arena it is presented to.
Sourcepub const fn non_null(self) -> Result<Self>
pub const fn non_null(self) -> Result<Self>
This handle, or Error::InvalidHandle if it is null.
§Errors
Error::InvalidHandle for the null handle.