-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
rust-lang/rust
#87312Description
Lines 50 to 54 in 55a2648
of collection types, including `HashMap`. For example, if we had the team names | |
and initial scores in two separate vectors, we could use the `zip` method to | |
create a vector of tuples where “Blue” is paired with 10, and so forth. Then we | |
could use the `collect` method to turn that vector of tuples into a hash map, | |
as shown in Listing 8-21. |
This description say
For example, if we had the team names and initial scores in two separate vectors, we could use the zip method to create a vector of tuples where “Blue” is paired with 10, and so forth. Then we could use the collect method to turn that vector of tuples into a hash map
But actually zip method returns std::iter::Zip<std::slice::Iter<std::string::String>, std::slice::Iter<i32>>
.
Also, if we compile vec![(String::from("Blue"), 10), (String::from("Yellow"), 50)].collect()
, we get error like this.
method cannot be called on
Vec<(String, {integer})>
due to unsatisfied trait bounds
Metadata
Metadata
Assignees
Labels
No labels