Skip to content

feat: add display_debug() for formatting Option<T> via Debug#6

Merged
drmingdrmer merged 3 commits intodatabendlabs:mainfrom
drmingdrmer:007-display-debug
Feb 9, 2026
Merged

feat: add display_debug() for formatting Option<T> via Debug#6
drmingdrmer merged 3 commits intodatabendlabs:mainfrom
drmingdrmer:007-display-debug

Conversation

@drmingdrmer
Copy link
Member

Changelog

feat: add display_debug() for formatting Option<T> via Debug

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
chore: bump ver 0.2.1
chore: prepare crate for crates.io publication

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.


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
Copy link

@xp-trumpet xp-trumpet left a comment

Choose a reason for hiding this comment

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

@xp-trumpet reviewed 4 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @drmingdrmer).

@drmingdrmer drmingdrmer merged commit b33071f into databendlabs:main Feb 9, 2026
1 check passed
@drmingdrmer drmingdrmer deleted the 007-display-debug branch February 9, 2026 09:40
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