Skip to content

Commit 822ae08

Browse files
authored
Updated EmbeddedIO to 0.7 and Rust Edition to 2024 (#56)
* Implemented traits for 0.7 embedded io * Updated rust version to 2024 * Updated formatting * Updated changelog
1 parent b0b589f commit 822ae08

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10-
No unreleased changes yet!
10+
### Changed
11+
* `embedded-io` version changed from 0.6.x to 0.7.x
12+
* Rust edition changed from 2018 to 2024
13+
14+
### Added
15+
* Implemented `core::fmt::Display` and `core::error::Error` for `io::Error` to
16+
allow for compatability with `embedded-io` 0.7.x
1117

1218
## [0.2.2] - 2024-04-22
1319

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "usbd-serial"
33
description = "USB CDC-ACM serial port class for use with usb-device."
44
version = "0.2.2"
5-
edition = "2018"
5+
edition = "2024"
66
readme = "README.md"
77
keywords = ["no-std", "usb-device"]
88
license = "MIT"
@@ -13,4 +13,4 @@ repository = "https://github.com/mvirkkunen/usbd-serial"
1313
embedded-hal = "0.2.4"
1414
nb = "1"
1515
usb-device = "0.3"
16-
embedded-io = "0.6"
16+
embedded-io = "0.7"

src/cdc_acm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use core::convert::TryInto;
22
use core::mem;
3+
use usb_device::Result;
34
use usb_device::class_prelude::*;
45
use usb_device::descriptor::lang_id::LangID;
56
use usb_device::device::DEFAULT_ALTERNATE_SETTING;
6-
use usb_device::Result;
77

88
/// This should be used as `device_class` when building the `UsbDevice`.
99
pub const USB_CLASS_CDC: u8 = 0x02;

src/io.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ impl From<usb_device::UsbError> for Error {
1111
}
1212
}
1313

14+
impl core::fmt::Display for Error {
15+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16+
write!(f, "{:?}", self)
17+
}
18+
}
19+
20+
impl core::error::Error for Error {}
21+
1422
impl embedded_io::Error for Error {
1523
fn kind(&self) -> embedded_io::ErrorKind {
1624
match self.0 {

src/serial_port.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use crate::buffer::{Buffer, DefaultBufferStore};
22
use crate::cdc_acm::*;
33
use core::borrow::BorrowMut;
44
use core::slice;
5+
use usb_device::Result;
56
use usb_device::class_prelude::*;
67
use usb_device::descriptor::lang_id::LangID;
7-
use usb_device::Result;
88

99
/// USB (CDC-ACM) serial port with built-in buffering to implement stream-like behavior.
1010
///

0 commit comments

Comments
 (0)