pub unsafe trait PriorityNumber: Copy {
const MAX_PRIORITY_NUMBER: usize;
// Required methods
fn number(self) -> usize;
fn from_number(value: usize) -> Result<Self>;
}
Expand description
Trait for enums of priority levels.
This trait should be implemented by a peripheral access crate (PAC) on its enum of available
priority numbers for a specific device. Each variant must convert to a usize
of its priority level.
§Safety
- This trait must only be implemented on a PAC of a RISC-V target.
- This trait must only be implemented on enums of priority levels.
- Each enum variant must represent a distinct value (no duplicates are permitted).
- Each enum variant must always return the same value (do not change at runtime).
- All the priority level numbers must be less than or equal to
MAX_PRIORITY_NUMBER
. MAX_PRIORITY_NUMBER
must coincide with the highest allowed priority number.
Required Associated Constants§
sourceconst MAX_PRIORITY_NUMBER: usize
const MAX_PRIORITY_NUMBER: usize
Number assigned to the highest priority level.
Required Methods§
sourcefn from_number(value: usize) -> Result<Self>
fn from_number(value: usize) -> Result<Self>
Tries to convert a number to a valid priority level.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.