pub struct StandardId { /* private fields */ }
Expand description
A standard 11 bit CAN ID.
Implementations§
Source§impl StandardId
impl StandardId
Sourcepub const fn new(id: u16) -> Result<Self, InvalidId>
pub const fn new(id: u16) -> Result<Self, InvalidId>
Try to create a new standard ID from a raw value.
Returns an error if the value doesn’t fit in 11 bits.
Sourcepub const fn from_u8(id: u8) -> Self
pub const fn from_u8(id: u8) -> Self
Create a new standard ID from a u8
.
Note that StandardId
also implements From<u8>
.
However, this function is usable in const
context.
Sourcepub const fn as_u16(self) -> u16
pub const fn as_u16(self) -> u16
Get the raw value as a u16
.
Note that StandardId
also implements Into<u16>
.
However, this function is usable in const
context.
Sourcepub const unsafe fn new_unchecked(id: u16) -> Self
pub const unsafe fn new_unchecked(id: u16) -> Self
Create a new standard CAN ID without checking for validity.
§Safety
The given ID must be a valid standard CAN ID (id <= MAX_STANDARD_ID
).
Trait Implementations§
Source§impl Clone for StandardId
impl Clone for StandardId
Source§fn clone(&self) -> StandardId
fn clone(&self) -> StandardId
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StandardId
impl Debug for StandardId
Source§impl From<StandardId> for CanId
impl From<StandardId> for CanId
Source§fn from(value: StandardId) -> Self
fn from(value: StandardId) -> Self
Converts to this type from the input type.
Source§impl From<StandardId> for ExtendedId
impl From<StandardId> for ExtendedId
Source§fn from(value: StandardId) -> Self
fn from(value: StandardId) -> Self
Converts to this type from the input type.
Source§impl From<u8> for StandardId
impl From<u8> for StandardId
Source§impl FromStr for StandardId
impl FromStr for StandardId
Source§impl LowerHex for StandardId
impl LowerHex for StandardId
Source§impl Ord for StandardId
impl Ord for StandardId
Source§fn cmp(&self, other: &StandardId) -> Ordering
fn cmp(&self, other: &StandardId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<CanId> for StandardId
impl PartialEq<CanId> for StandardId
Source§impl PartialEq<StandardId> for CanId
impl PartialEq<StandardId> for CanId
Source§impl PartialEq for StandardId
impl PartialEq for StandardId
Source§impl PartialOrd for StandardId
impl PartialOrd for StandardId
Source§impl TryFrom<CanId> for StandardId
impl TryFrom<CanId> for StandardId
Source§impl TryFrom<ExtendedId> for StandardId
impl TryFrom<ExtendedId> for StandardId
Source§impl TryFrom<u16> for StandardId
impl TryFrom<u16> for StandardId
Source§impl TryFrom<u32> for StandardId
impl TryFrom<u32> for StandardId
Source§impl UpperHex for StandardId
impl UpperHex for StandardId
impl Copy for StandardId
impl Eq for StandardId
impl StructuralPartialEq for StandardId
Auto Trait Implementations§
impl Freeze for StandardId
impl RefUnwindSafe for StandardId
impl Send for StandardId
impl Sync for StandardId
impl Unpin for StandardId
impl UnwindSafe for StandardId
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
Mutably borrows from an owned value. Read more