Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tweak the CompactStringExt trait so join_compact and concat_compact work better #418

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ParkMyCar
Copy link
Owner

@ParkMyCar ParkMyCar commented Dec 29, 2024

Fixes #412

This is a possibly breaking change.

Previously CompactStringExt was (more or less) implemented for any type C where a &C implemented IntoIterator<Item = &str>. This worked well for when you wanted to join Vecs or slices, but would result in a confusing compile time error when you tried to join an iterator of some type, e.g. when you tried to do values.iter().map(|val| val.trim()).join_compact(",").

There is a blanket impl for IntoIterator for all types that implement Iterator, but our trait bound required some reference of a type to implement IntoIterator which wasn't covered by this blanket impl.

…mpact work better

* changes the blanket trait impl so iterator types like Map can also have join_compact called with them
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.

extend CompactStringExt implementation
1 participant