Priority

Enum Priority 

Source
#[repr(u8)]
pub enum Priority { Exceptional = 0, Immediate = 1, Fast = 2, High = 3, Nominal = 4, Low = 5, Slow = 6, Optional = 7, }
Expand description

Transfer priority [1; 4.1.1.3]

The type has explicit numeric encoding to facilitate look-up table implementation. The encoding matches the CAN ID encoding [1; 4.2.1.1], thus the ordering is reversed: Optional > Exceptional

Variants§

§

Exceptional = 0

The bus designer can ignore these messages when calculating bus load since they should only be sent when a total system failure has occurred. For example, a self-destruct message on a rocket would use this priority. Another analogy is an NMI on a microcontroller.

§

Immediate = 1

Immediate is a “high priority message” but with additional latency constraints. Since exceptional messages are not considered when designing a bus, the latency of immediate messages can be determined by considering only immediate messages.

§

Fast = 2

Fast and immediate are both “high priority messages” but with additional latency constraints. Since exceptional messages are not considered when designing a bus, the latency of fast messages can be determined by considering only immediate and fast messages.

§

High = 3

High priority messages are more important than nominal messages but have looser latency requirements than fast messages. This priority is used so that, in the presence of rogue nominal messages, important commands can be received. For example, one might envision a failure mode where a temperature sensor starts to load a vehicle bus with nominal messages. The vehicle remains operational (for a time) because the controller is exchanging fast and immediate messages with sensors and actuators. A system safety monitor is able to detect the distressed bus and command the vehicle to a safe state by sending high priority messages to the controller.

§

Nominal = 4

This is what all messages should use by default. Specifically, heartbeat messages should use this priority.

§

Low = 5

Low priority messages are expected to be sent on a bus under all conditions but cannot prevent the delivery of nominal messages. They are allowed to be delayed, but latency should be constrained by the bus designer.

§

Slow = 6

Slow messages are low priority messages that have no time sensitivity at all. The bus designer need only ensure that for all possible system states, these messages will eventually be sent.

§

Optional = 7

These messages might never be sent (theoretically) for some possible system states. The system shall tolerate never exchanging optional messages in every possible state. The bus designer can ignore these messages when calculating bus load. This should be the priority used for diagnostic or debug messages that are not required on an operational system.

Implementations§

Source§

impl Priority

Source

pub const MIN: Priority = Priority::Exceptional

Source

pub const MAX: Priority = Priority::Optional

Source

pub const fn try_from_u8(code: u8) -> Option<Priority>

Source

pub const fn from_u8_truncating(code: u8) -> Priority

Source

pub const fn into_u8(self) -> u8

Source

pub const fn next(self) -> Option<Self>

Source

pub const fn prev(self) -> Option<Self>

Trait Implementations§

Source§

impl Clone for Priority

Source§

fn clone(&self) -> Priority

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Priority

Source§

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

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

impl From<Priority> for u8

Source§

fn from(value: Priority) -> Self

Converts to this type from the input type.
Source§

impl From<Priority> for usize

Source§

fn from(value: Priority) -> Self

Converts to this type from the input type.
Source§

impl Ord for Priority

Source§

fn cmp(&self, other: &Priority) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Priority

Source§

fn eq(&self, other: &Priority) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Priority

Source§

fn partial_cmp(&self, other: &Priority) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<u8> for Priority

Source§

type Error = InvalidValue

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Priority

Source§

impl Eq for Priority

Source§

impl StructuralPartialEq for Priority

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.