[feature] add Join trait
after-ephemera opened this issue · 4 comments
It would be nice it ColoredString implemented Join so you can join slices of ColoredString
s.
Thanks for the issie @after-ephemera! I looked at the documentation for Join
and you can only implement it on Rust Nightly right now, and I'd likewise probably end up holding off on implementing it.
Would the Add
trait be acceptable for you? Then you could do stuff like ColoredString + &ColoredString
, which I feel like would be a more common use case as well.
What do you think?
Yeah I think Add
would be absolutely sufficient for this kind of use case.
Hello I came into here looking for a join
method as well. I have a vector of ColoredString
which I need to put into one giant ColoredString
. Currently I have it set up like this
let mut buffer = String::new();
for part in colored_strings {
write!(buffer, "{part}")?;
}
buffer
and I am hoping to return a ColoredString instead of a String.
It might be worth implementing FromIterator