Skip to content

foundations-macros: add Display derive for trivial struct/enum Display - #279

Merged
TheJokr merged 3 commits into
mainfrom
cbranch/macro-display
Oct 15, 2026
Merged

TheJokr merged 3 commits into
mainfrom
cbranch/macro-display

Conversation

@cbranch

@cbranch cbranch commented Oct 13, 2026

Copy link
Copy Markdown
Member

A simple way to quickly implement Display implementations on structs and enums, inspired by thiserror but not specifically for errors.

Although, errors are a good reason for this (std::error::Error's trait bounds require Display), so we also add a convenience derive named Error that adds the impl Error for T automatically.

Comment thread foundations-macros/src/lib.rs
Comment thread foundations-macros/src/display.rs
Comment thread foundations-macros/src/display.rs
Comment thread foundations-macros/src/display.rs
Comment thread foundations-macros/src/display.rs
@cbranch
cbranch force-pushed the cbranch/macro-display branch from 7b800f6 to 1af1733 Compare October 14, 2026 19:27
A simple way to quickly implement Display implementations on structs
and enums, inspired by `thiserror` but not specifically for errors.

Although, errors are a good reason for this (`std::error::Error`'s
trait bounds require `Display`), so we also add a convenience derive
named `Error` that adds the `impl Error for T` automatically.

This is enabled by setting the "derive" feature.
@cbranch
cbranch force-pushed the cbranch/macro-display branch from 4a68d6b to 0e8c7b5 Compare October 14, 2026 19:33
@TheJokr
TheJokr merged commit 2e2f105 into main Oct 15, 2026
20 checks passed
@TheJokr TheJokr mentioned this pull request Oct 23, 2026
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