feat: add display_debug() for formatting Option<T> via Debug#6
Merged
drmingdrmer merged 3 commits intodatabendlabs:mainfrom Feb 9, 2026
Merged
Conversation
Add complete crates.io metadata to `Cargo.toml` including repository, homepage, documentation URLs, readme field, keywords, and categories to ensure proper discoverability on crates.io. Update README.md with corrected trait names in examples (DisplayOptionExt, DisplayResultExt, DisplaySliceExt, DisplayUnixTimeStampExt), add missing DisplayResult example, and update version from 0.1.0 to 0.2.0. Remove unnecessary sections for improved clarity. Enhance crate-level documentation in lib.rs with comprehensive examples for all four extension traits (Option, Result, Slice, Unix Timestamp) to provide better API documentation on docs.rs.
`DisplayOption` now stores a format function pointer (`fmt_fn`) instead of requiring `T: Display` on the struct. This lets the same wrapper support both `Display` and `Debug` formatting, selected at construction time. `DisplayOptionExt::display()` sets `fmt_fn` to `Display::fmt` (unchanged behavior). The new `DisplayDebugOptionExt::display_debug()` sets it to `Debug::fmt`, useful for types that implement `Debug` but not `Display` (e.g., `Vec<T>`). Changes: - Replace tuple struct with named fields (`inner`, `fmt_fn`) - Remove `T: Display` bound from `DisplayOption` struct and its `Display` impl - Add `DisplayDebugOptionExt` trait with `.display_debug()` method
xp-trumpet
reviewed
Feb 9, 2026
xp-trumpet
left a comment
There was a problem hiding this comment.
@xp-trumpet reviewed 4 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @drmingdrmer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
feat: add
display_debug()for formattingOption<T>viaDebugDisplayOptionnow stores a format function pointer (fmt_fn) instead ofrequiring
T: Displayon the struct. This lets the same wrapper support bothDisplayandDebugformatting, selected at construction time.DisplayOptionExt::display()setsfmt_fntoDisplay::fmt(unchangedbehavior). The new
DisplayDebugOptionExt::display_debug()sets it toDebug::fmt, useful for types that implementDebugbut notDisplay(e.g.,
Vec<T>).Changes:
inner,fmt_fn)T: Displaybound fromDisplayOptionstruct and itsDisplayimplDisplayDebugOptionExttrait with.display_debug()methodchore: bump ver 0.2.1
chore: prepare crate for crates.io publication
Add complete crates.io metadata to
Cargo.tomlincluding repository,homepage, documentation URLs, readme field, keywords, and categories
to ensure proper discoverability on crates.io.
Update README.md with corrected trait names in examples
(DisplayOptionExt, DisplayResultExt, DisplaySliceExt,
DisplayUnixTimeStampExt), add missing DisplayResult example, and
update version from 0.1.0 to 0.2.0. Remove unnecessary sections for
improved clarity.
Enhance crate-level documentation in lib.rs with comprehensive
examples for all four extension traits (Option, Result, Slice, Unix
Timestamp) to provide better API documentation on docs.rs.