How can i convert an iterator to tuple?

Hi,

If i have a string that looks like this abcd:ef how can extract to two variables in rust

example (not working)

let (a1, a2) = item.split(':').collect::<(&str, &str)>();
2 Likes

There's collect tuple in itertools: itertools::Itertools - Rust

In std, I think you'll have to call .next repeatedly.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.