Enum embedded_can::Id
source · [−]pub enum Id {
Standard(StandardId),
Extended(ExtendedId),
}
Expand description
A CAN Identifier (standard or extended).
Variants
Standard(StandardId)
Standard 11-bit Identifier (0..=0x7FF
).
Extended(ExtendedId)
Extended 29-bit Identifier (0..=0x1FFF_FFFF
).
Trait Implementations
sourceimpl From<ExtendedId> for Id
impl From<ExtendedId> for Id
sourcefn from(id: ExtendedId) -> Self
fn from(id: ExtendedId) -> Self
sourceimpl From<StandardId> for Id
impl From<StandardId> for Id
sourcefn from(id: StandardId) -> Self
fn from(id: StandardId) -> Self
sourceimpl Ord for Id
impl Ord for Id
Implement Ord
according to the CAN arbitration rules
When performing arbitration, frames are looked at bit for bit starting from the beginning. A bit with the value 0 is dominant and a bit with value of 1 is recessive.
When two devices are sending frames at the same time, as soon as the first bit is found which differs, the frame with the corresponding dominant 0 bit will win and get to send the rest of the frame.
This implementation of Ord
for Id
will take this into consideration
and when comparing two different instances of Id
the “smallest” will
always be the ID which would form the most dominant frame, all other
things being equal.
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialOrd<Id> for Id
impl PartialOrd<Id> for Id
sourcefn partial_cmp(&self, other: &Id) -> Option<Ordering>
fn partial_cmp(&self, other: &Id) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more