Skip to content

add defmt support#77

Merged
diondokter merged 2 commits into
rust-embedded-community:masterfrom
robamu:defmt-support
Mar 30, 2026
Merged

add defmt support#77
diondokter merged 2 commits into
rust-embedded-community:masterfrom
robamu:defmt-support

Conversation

@robamu

@robamu robamu commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Not sure if #71 will be updated.

Comment thread src/nor_flash.rs Outdated
/// NOR flash implementations must use an error type implementing this trait. This permits generic
/// code to extract a generic error kind.
pub trait NorFlashError: core::fmt::Debug {
pub trait NorFlashError {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this bound is still reasonable, and shouldn't be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this based on the review in #71 .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But I suppose it is always okay to require Debug, yes. I'll add it back

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I see. So the thinking is you can write T: NorFlashError + core::fmt::Debug where you want to print it to the console, but T: NorFlashError + defmt::Format where you want to log it with defmt? That kind of makes sense, but also all errors should really impl core::fmt::Debug, even in a no_std library. It's just so useful.

@diondokter diondokter merged commit 44beec8 into rust-embedded-community:master Mar 30, 2026
7 checks passed
@robamu robamu deleted the defmt-support branch March 30, 2026 21:09
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