pub enum CanId {
Standard(u16),
Extended(u32),
}Expand description
A CAN identifier: 11-bit (standard) or 29-bit (extended).
dbc-parse carries its own minimal CanId rather than depending on the
estate’s can-core: L0 crates have zero runtime estate dependencies
(docs/layers.md, engineering-standards). The shape mirrors can-core
so a future higher-layer bridge can convert with match.
The tuple variants are public, so — as in can-core — the crate’s
contract is defense in depth: the validating constructors reject
out-of-range values and the parser never produces an out-of-range id.
Variants§
Standard(u16)
11-bit standard identifier, 0x000..=0x7FF (a u11 in a u16).
Extended(u32)
29-bit extended identifier, 0x000..=0x1FFF_FFFF (a u29 in a
u32).
Implementations§
Source§impl CanId
impl CanId
Sourcepub fn extended(raw: u32) -> Result<Self, DbcError>
pub fn extended(raw: u32) -> Result<Self, DbcError>
Validates and wraps a 29-bit extended identifier.
§Errors
DbcError::InvalidId when raw > 0x1FFF_FFFF.
Sourcepub fn from_dbc_raw(raw: u32) -> Result<Self, DbcError>
pub fn from_dbc_raw(raw: u32) -> Result<Self, DbcError>
Interprets a DBC BO_ id word: bit 31 (0x8000_0000) marks an
extended frame and is stripped; the remaining 29 bits are the id.
A plain id that exceeds the 11-bit standard width is rejected —
the DBC format requires bit 31 for extended frames.
§Errors
DbcError::InvalidId for error/flag bits below bit 31 or an
over-wide standard id.
Sourcepub const fn is_standard(&self) -> bool
pub const fn is_standard(&self) -> bool
true for the 11-bit standard format.