Skip to content

Commit 7dc7a7b

Browse files
committed
CAN: Add safety documentation section in unsafe methods
1 parent e131ae7 commit 7dc7a7b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/can/id.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ impl StandardId {
2424
}
2525

2626
/// Creates a new `StandardId` without checking if it is inside the valid range.
27+
///
28+
/// # Safety
29+
/// Using this method can create an invalid ID and is thus marked as unsafe.
2730
#[inline]
2831
pub const unsafe fn new_unchecked(raw: u16) -> Self {
2932
Self(raw)
@@ -60,6 +63,9 @@ impl ExtendedId {
6063
}
6164

6265
/// Creates a new `ExtendedId` without checking if it is inside the valid range.
66+
///
67+
/// # Safety
68+
/// Using this method can create an invalid ID and is thus marked as unsafe.
6369
#[inline]
6470
pub const unsafe fn new_unchecked(raw: u32) -> Self {
6571
Self(raw)

0 commit comments

Comments
 (0)