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

Add optional support for printing some types with defmt #304

Merged
merged 3 commits into from
Jan 4, 2022

Conversation

mattico
Copy link
Contributor

@mattico mattico commented Dec 27, 2021

defmt ("de format", short for "deferred formatting") is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers.

https://defmt.ferrous-systems.com/

I've been maintaining this support in my fork for some time, it hasn't been burdensome. defmt has become popular enough that I think it is worthwhile to upstream this. Supporting defmt formatting in this library makes it easier to print error messages (don't need to use defmt::Debug2Format) and eliminates the code bloat of the core::fmt machinery. We could similarly move Debug derives behind a feature flag to help people who are trying to eliminate core::fmt, but I don't particularly care.

@mattico
Copy link
Contributor Author

mattico commented Dec 27, 2021

Okay, defmt 0.3 crates require edition 2021 - MSRV 1.56.0. I could bump the MSRV, or just change CI to not use defmt 0.3 on 1.52.0.

@richardeoin
Copy link
Member

Thanks, this is quite nice (although I've not used defmt much myself). Could you add a short section in the lib.rs docs to help users find this flag? Otherwise LGTM!

I bumped the MSRV in #236 so should be good now

bors delegate=mattico

@bors
Copy link
Contributor

bors bot commented Jan 3, 2022

✌️ mattico can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mattico
Copy link
Contributor Author

mattico commented Jan 4, 2022

@bors r+

@mattico
Copy link
Contributor Author

mattico commented Jan 4, 2022

@bors r+

@mattico
Copy link
Contributor Author

mattico commented Jan 4, 2022

bors r+

@bors bors bot merged commit 4ebb5c1 into stm32-rs:master Jan 4, 2022
@mattico mattico deleted the defmt branch January 4, 2022 17:53
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.

2 participants