Skip to content

Commit 1d69c2a

Browse files
chrysnrursprung
andcommitted
io, io-async: Update defmt to 1.0, rename feature from "defmt_03" to "defmt"
Co-authored-by: Ralph Ursprung <[email protected]>
1 parent 20e5484 commit 1d69c2a

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cargo build
3737
--workspace
3838
--target thumbv7m-none-eabi
39-
--features async,defmt-03
39+
--features async,defmt-03,embedded-io/defmt,embedded-io-async/defmt
4040
4141
msrv-1-81:
4242
runs-on: ubuntu-latest

embedded-io-async/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ categories = [
1515
[features]
1616
std = ["alloc", "embedded-io/std"]
1717
alloc = ["embedded-io/alloc"]
18-
defmt-03 = ["dep:defmt-03", "embedded-io/defmt-03"]
18+
defmt = ["dep:defmt", "embedded-io/defmt"]
1919

2020
[dependencies]
2121
embedded-io = { version = "0.6.1", path = "../embedded-io" }
22-
defmt-03 = { package = "defmt", version = "0.3", optional = true }
22+
defmt = { package = "defmt", version = "1", optional = true }
2323

2424
[package.metadata.docs.rs]
2525
features = ["std"]

embedded-io-async/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project is developed and maintained by the [HAL team](https://github.com/ru
1414

1515
- **`std`**: Adds `From` impls to convert to/from `std::io` structs.
1616
- **`alloc`**: Adds blanket impls for `Box`, adds `Write` impl to `Vec`.
17-
- **`defmt-03`**: Derive `defmt::Format` from `defmt` 0.3 for enums and structs.
17+
- **`defmt`**: Derive `defmt::Format` from `defmt` 1.0 for enums and structs.
1818

1919
## Minimum Supported Rust Version (MSRV)
2020

embedded-io/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ categories = [
1515
[features]
1616
std = ["alloc"]
1717
alloc = []
18-
defmt-03 = ["dep:defmt-03"]
18+
defmt = ["dep:defmt"]
1919

2020
[dependencies]
21-
defmt-03 = { package = "defmt", version = "0.3", optional = true }
21+
defmt = { version = "1", optional = true }
2222

2323
[package.metadata.docs.rs]
2424
features = ["std"]

embedded-io/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
use core::fmt;
77

8-
// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
9-
#[cfg(feature = "defmt-03")]
10-
use defmt_03 as defmt;
11-
128
#[cfg(feature = "alloc")]
139
extern crate alloc;
1410

@@ -18,7 +14,7 @@ mod impls;
1814
///
1915
/// This is the `embedded-io` equivalent of [`std::io::SeekFrom`].
2016
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
21-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
17+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2218
pub enum SeekFrom {
2319
/// Sets the offset to the provided number of bytes.
2420
Start(u64),
@@ -62,7 +58,7 @@ impl From<std::io::SeekFrom> for SeekFrom {
6258
///
6359
/// - `WouldBlock` is removed, since `embedded-io` traits are always blocking. See the [crate-level documentation](crate) for details.
6460
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
65-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
61+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6662
#[non_exhaustive]
6763
pub enum ErrorKind {
6864
/// Unspecified error kind.
@@ -229,7 +225,7 @@ impl<T: ?Sized + ErrorType> ErrorType for &mut T {
229225

230226
/// Error returned by [`Read::read_exact`]
231227
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
232-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
228+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
233229
pub enum ReadExactError<E> {
234230
/// An EOF error was encountered before reading the exact amount of requested bytes.
235231
UnexpectedEof,
@@ -267,7 +263,7 @@ impl<E: fmt::Debug> core::error::Error for ReadExactError<E> {}
267263

268264
/// Errors that could be returned by `Write` on `&mut [u8]`.
269265
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
270-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
266+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
271267
#[non_exhaustive]
272268
pub enum SliceWriteError {
273269
/// The target slice was full and so could not receive any new data.
@@ -276,7 +272,7 @@ pub enum SliceWriteError {
276272

277273
/// Error returned by [`Write::write_fmt`]
278274
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
279-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
275+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280276
pub enum WriteFmtError<E> {
281277
/// An error was encountered while formatting.
282278
FmtError,

0 commit comments

Comments
 (0)