Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: add defmt support, release v0.5 #481

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Aug 6, 2023

following discussions in #450, the Cargo feature is named defmt-03 instead of defmt. This leaves the door open to add support for newer versions of defmt in the future without breaking changes, naming the features defmt-04 or defmt-1, like this:

[dependencies]
defmt-03 = { package = "defmt", version = "0.3", optional = true }
defmt-04 = { package = "defmt", version = "0.4", optional = true }
// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
#[cfg(feature = "defmt-03")]
use defmt_03 as defmt;
#[cfg(feature = "defmt-04")]
use defmt_04 as defmt;

[cfg_attr(any(feature = "defmt-03", feature = "defmt-04"), derive(defmt::Format))]
pub enum Blah { .. }

One downside is this breaks if you enable both defmt-03 and defmt-04. This is annoying, because in theory it should be possible to impl both the 0.3 and 0.4 Format on the same struct. However in practice it's unlikely that a user wants this since defmt doesn't allow mixing major versions in the same binary anyway.

@Dirbaio Dirbaio requested a review from a team as a code owner August 6, 2023 13:37
@Dirbaio Dirbaio mentioned this pull request Aug 6, 2023
@Dirbaio Dirbaio force-pushed the embedded-io-release branch from 0ad0155 to 6ea5659 Compare August 6, 2023 13:41
@Dirbaio
Copy link
Member Author

Dirbaio commented Aug 6, 2023

updated most of Embassy here, no issues to report. embassy-rs/embassy#1752

@ryankurte
Copy link
Contributor

One downside is this breaks if you enable both defmt-03 and defmt-04.

because the generated macros refer to defmt by path i don't think this can ever be possible* ? but seems like an okay compromise to me.

* without defmt macros internally using versioned paths, or maybe using some macro trickery to get a $1 from the macro invocation

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!
Would you do the release honors @Dirbaio?

@eldruin eldruin added this pull request to the merge queue Aug 7, 2023
Merged via the queue into rust-embedded:master with commit 6d83939 Aug 7, 2023
@Dirbaio
Copy link
Member Author

Dirbaio commented Aug 7, 2023

embedded-io, embedded-io-async, embedded-io-adapters v0.5.0 released 🚀

also, added HAL team as owners.

@ryankurte: because the generated macros refer to defmt by path i don't think this can ever be possible* ?

yeah, I don't think it's posisble either, without changes to defmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants