[−][src]Function display_utils::join
pub fn join<T, I, J>(iterator: I, joiner: J) -> impl Display where
T: Display,
I: IntoIterator<Item = T>,
I::IntoIter: Clone,
J: Display,
Concatenate iterator elements, separating each element pair with a given joiner.
Equivalent to slice::join
.
The iterator must be cloneable, because Display objects may be printed multiple times.
let strings = &["hello", "wonderful", "world"]; let output = join(strings, ", "); assert_eq!(output.to_string(), "hello, wonderful, world");