I have being doing rustling exercises and specifically one about iterators where I end up with a following solution:
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = words
.iter()
.map(|&word| capitalize_first(&word))
.collect::<Vec<String>>()
.join("");
assert_eq!(capitalized_words, "Hello World");
}
However as I was reading API docs for join
made me wondering how to read type signature
pub fn join<Separator>(
&self,
sep: Separator
) -> <[T] as Join<Separator>>::Output where
[T]: Join<Separator>,
I'm unable to understand what the Output
type supposed to be nor following trait documentation for std::slice::join
seems to explain much.
Can anyone please help me understand how to read this and to come to conclusion that Output
is String
?
Thanks