Skip to content

Commit 2e59b62

Browse files
committed
improvements for naming and docs
1 parent 9db215f commit 2e59b62

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

embedded-can/src/id.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,16 @@ pub enum Id {
105105
}
106106

107107
impl Id {
108-
/// Returns the CAN Identifier as a raw 32-bit integer.
108+
/// Returns the CAN Identifier as a raw 32-bit integer, ignoring the distinction between
109+
/// standard ID and extended ID.
110+
///
111+
/// This function ignores that a standard ID and an extended ID are different IDs, even
112+
/// if their numerical values are the same. It should only be used if the raw numerical value
113+
/// is required and the distinction between standard ID and extended ID is irrelevant.
114+
///
115+
/// In all other cases, it is recommended to de-structure the ID with a match statement.
109116
#[inline]
110-
pub fn as_raw(&self) -> u32 {
117+
pub fn as_raw_unchecked(&self) -> u32 {
111118
match self {
112119
Id::Standard(id) => id.as_raw() as u32,
113120
Id::Extended(id) => id.as_raw(),

0 commit comments

Comments
 (0)