Skip to content

Feature: defmt support - #137

Merged
robin-nitrokey merged 2 commits into
trussed-dev:mainfrom
taks:defmt
Aug 8, 2026
Merged

Feature: defmt support#137
robin-nitrokey merged 2 commits into
trussed-dev:mainfrom
taks:defmt

Conversation

@taks

@taks taks commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@robin-nitrokey robin-nitrokey left a comment

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.

Thanks for the PR! I have two requests:

  • Ideally features should be additive. Currently, enabling defmt disables delog. Do you see a way to support defmt and delog independent of each other? Maybe with a custom macro that dispatches to defmt and/or delog based on the features?
  • To avoid the duplication in the Debug and defmt::Format implementation for Error, I think it would make sense to have a pub const fn as_str(&self) -> Option<&'static str> that is used by both.

@taks

taks commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your review.

Strings written within the defmt::Format are not included in the logging data.
https://defmt.ferrous-systems.com/#operating-principle

However, if I move the strings to another function, the strings are included in the logging data.
For that reason, it is not a good to refactor into a common function.

By defining Error as an enum, we can use #[derive(Debug)].
If you'd like, I can redefine Error as an enum.

@robin-nitrokey

Copy link
Copy Markdown
Member

I see, thanks for the explanation. Please add a short comment with what you just wrote to the defmt::Format implementation so that we don’t end up refactoring this in the future.

We deliberately don’t have Error as an enum so that adding new error variants is not a breaking change.

@robin-nitrokey robin-nitrokey added the skip-publish-check Skip the check that tests publishing to crates.io for this PR label Aug 6, 2026

@robin-nitrokey robin-nitrokey left a comment

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 you ended up using debug! instead of debug_lib! in some lines.

Comment thread src/fs.rs Outdated
Comment thread src/fs.rs Outdated
Comment thread src/fs.rs Outdated
Comment thread src/fs.rs Outdated
@robin-nitrokey robin-nitrokey added skip-publish-check Skip the check that tests publishing to crates.io for this PR and removed skip-publish-check Skip the check that tests publishing to crates.io for this PR labels Aug 8, 2026
@robin-nitrokey
robin-nitrokey merged commit f9a154a into trussed-dev:main Aug 8, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-publish-check Skip the check that tests publishing to crates.io for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants