pub enum ShortId {
LocallyUnique,
Fixed(NonZeroU32),
}
Expand description
A compressed form of an Application Identifier.
ShortIds are useful for more efficient operations with app identifiers within the kernel. They are guaranteed to be unique among all running processes on the same board. However, as they are only 32 bits they are not globally unique.
ShortIds are persistent across restarts of the same app (whereas ProcessIDs are not).
As ShortIds must be unique for each app on a board, and since not every
platform may have a use for ShortIds, the definition of a ShortId provides a
convenient mechanism for meeting the uniqueness requirement without actually
requiring assigning unique discrete values to each app. This is done with
the LocallyUnique
variant which is an abstract ID that is guaranteed to be
unique (i.e. an equality comparison with any other ShortId will always
return false
). Platforms which have a use for an actual number for a
ShortId
should use the Fixed(NonZeroU32)
variant. Note, for type space
efficiency, we disallow using the number 0 as a fixed ShortId.
ShortIds are assigned to the app as part of the credential checking process.
Specifically, an implementation of the process_checker::Compress
trait
assigns ShortIds.
Variants§
LocallyUnique
An abstract ShortId
that is always guaranteed to be unique. As this is
not an actual discrete value, it cannot be used for anything other than
meeting the uniqueness requirement.
Fixed(NonZeroU32)
A 32 bit number ShortId
. This fixed value is guaranteed to be unique
among all running processes as the kernel will not start two processes
with the same ShortId.
Trait Implementations§
source§impl PartialEq for ShortId
impl PartialEq for ShortId
impl Copy for ShortId
impl Eq for ShortId
Auto Trait Implementations§
impl Freeze for ShortId
impl RefUnwindSafe for ShortId
impl Send for ShortId
impl Sync for ShortId
impl Unpin for ShortId
impl UnwindSafe for ShortId
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)