diff --git a/CHANGELOG.md b/CHANGELOG.md index 04112b1..d904545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -No unreleased changes yet! +### Changed +* `embedded-io` version changed from 0.6.x to 0.7.x +* Rust edition changed from 2018 to 2024 + +### Added +* Implemented `core::fmt::Display` and `core::error::Error` for `io::Error` to + allow for compatability with `embedded-io` 0.7.x ## [0.2.2] - 2024-04-22 diff --git a/Cargo.toml b/Cargo.toml index 1ce1eba..752807e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "usbd-serial" description = "USB CDC-ACM serial port class for use with usb-device." version = "0.2.2" -edition = "2018" +edition = "2024" readme = "README.md" keywords = ["no-std", "usb-device"] license = "MIT" @@ -13,4 +13,4 @@ repository = "https://github.com/mvirkkunen/usbd-serial" embedded-hal = "0.2.4" nb = "1" usb-device = "0.3" -embedded-io = "0.6" +embedded-io = "0.7" diff --git a/src/cdc_acm.rs b/src/cdc_acm.rs index 3939763..24f0c1a 100644 --- a/src/cdc_acm.rs +++ b/src/cdc_acm.rs @@ -1,9 +1,9 @@ use core::convert::TryInto; use core::mem; +use usb_device::Result; use usb_device::class_prelude::*; use usb_device::descriptor::lang_id::LangID; use usb_device::device::DEFAULT_ALTERNATE_SETTING; -use usb_device::Result; /// This should be used as `device_class` when building the `UsbDevice`. pub const USB_CLASS_CDC: u8 = 0x02; diff --git a/src/io.rs b/src/io.rs index 0b965e4..a6870ec 100644 --- a/src/io.rs +++ b/src/io.rs @@ -11,6 +11,14 @@ impl From for Error { } } +impl core::fmt::Display for Error { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{:?}", self) + } +} + +impl core::error::Error for Error {} + impl embedded_io::Error for Error { fn kind(&self) -> embedded_io::ErrorKind { match self.0 { diff --git a/src/serial_port.rs b/src/serial_port.rs index 1e05e89..44ba957 100644 --- a/src/serial_port.rs +++ b/src/serial_port.rs @@ -2,9 +2,9 @@ use crate::buffer::{Buffer, DefaultBufferStore}; use crate::cdc_acm::*; use core::borrow::BorrowMut; use core::slice; +use usb_device::Result; use usb_device::class_prelude::*; use usb_device::descriptor::lang_id::LangID; -use usb_device::Result; /// USB (CDC-ACM) serial port with built-in buffering to implement stream-like behavior. ///