Skip to content

Commit baa9597

Browse files
committed
add is_extended default impl for CAN frame
1 parent 5209452 commit baa9597

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

embedded-can/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
- Added `core::error::Error` implementations for every custom `impl Error`
1111
- Increased MSRV to 1.81 due to `core::error::Error`
12+
- Added `is_extended` default implementation for CAN frame.
1213

1314
## [v0.4.1] - 2022-09-28
1415

embedded-can/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ pub trait Frame: Sized {
2323
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>;
2424

2525
/// Returns true if this frame is an extended frame.
26-
fn is_extended(&self) -> bool;
26+
fn is_extended(&self) -> bool {
27+
match self.id() {
28+
Id::Standard(_) => false,
29+
Id::Extended(_) => true,
30+
}
31+
}
2732

2833
/// Returns true if this frame is a standard frame.
2934
fn is_standard(&self) -> bool {

0 commit comments

Comments
 (0)