feat: add customizable ellipsis, element prefix/suffix, and show-count for DisplaySlice#9
Merged
drmingdrmer merged 3 commits intodatabendlabs:mainfrom Feb 17, 2026
Conversation
`DisplaySlice` previously hardcoded `[` and `]` as surrounding braces.
This adds a `braces()` builder method to configure them, following the
same pattern as `sep()`. Defaults remain `[` / `]` for backward
compatibility.
Example:
vec![1, 2, 3].display().braces("{", "}").to_string()
// => "{1,2,3}"
vec![1, 2, 3].display().braces("<", ">").sep(", ").to_string()
// => "<1, 2, 3>"
…t for `DisplaySlice`
Three new builder methods extend `DisplaySlice` formatting:
- `.ellipsis(s)` replaces the hardcoded `..` truncation indicator with any string
- `.elem(prefix, suffix)` wraps each displayed element (but not the ellipsis)
- `.show_count()` appends `(N total)` to the ellipsis when truncation occurs
The `show_count` feature only allocates a `format!` string when both active and
truncation is needed; the common path remains allocation-free.
Example:
vec![1,2,3,4,5,6,7].display()
.ellipsis("...").show_count().elem("'", "'").sep(", ").braces("{", "}")
// => {'1', '2', '3', '4', ...(7 total), '7'}
xp-trumpet
reviewed
Feb 17, 2026
xp-trumpet
left a comment
There was a problem hiding this comment.
@xp-trumpet reviewed 2 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 customizable ellipsis, element prefix/suffix, and show-count for
DisplaySliceThree new builder methods extend
DisplaySliceformatting:.ellipsis(s)replaces the hardcoded..truncation indicator with any string.elem(prefix, suffix)wraps each displayed element (but not the ellipsis).show_count()appends(N total)to the ellipsis when truncation occursThe
show_countfeature only allocates aformat!string when both active andtruncation is needed; the common path remains allocation-free.
Example:
feat: add customizable braces for
DisplaySliceDisplaySlicepreviously hardcoded[and]as surrounding braces.This adds a
braces()builder method to configure them, following thesame pattern as
sep(). Defaults remain[/]for backwardcompatibility.
Example:
chore: Bump ver: 0.2.4