Skip to content

Commit 24b9e8a

Browse files
committed
io: Update defmt to 1.0, rename feature from "defmt_03" to "defmt"
1 parent 3f83185 commit 24b9e8a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
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,defmt
4040
4141
msrv-1-81:
4242
runs-on: ubuntu-latest

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.0.0", optional = true }
2222

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

embedded-io/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
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;
8+
// Note that defmt macros depend on this being named "defmt" precisely, since they emit code that does `defmt::blahblah`.
9+
#[cfg(feature = "defmt")]
10+
use defmt;
1111

1212
#[cfg(feature = "alloc")]
1313
extern crate alloc;
@@ -18,7 +18,7 @@ mod impls;
1818
///
1919
/// This is the `embedded-io` equivalent of [`std::io::SeekFrom`].
2020
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
21-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
21+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2222
pub enum SeekFrom {
2323
/// Sets the offset to the provided number of bytes.
2424
Start(u64),
@@ -62,7 +62,7 @@ impl From<std::io::SeekFrom> for SeekFrom {
6262
///
6363
/// - `WouldBlock` is removed, since `embedded-io` traits are always blocking. See the [crate-level documentation](crate) for details.
6464
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
65-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
65+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6666
#[non_exhaustive]
6767
pub enum ErrorKind {
6868
/// Unspecified error kind.
@@ -229,7 +229,7 @@ impl<T: ?Sized + ErrorType> ErrorType for &mut T {
229229

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

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

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

0 commit comments

Comments
 (0)