Consider the following code:
let mut centroids: Vec<(f64, f64)> = Vec::new();
centroids.extend((90.0, 0.0));
It produces error 277:
error[E0277]: `({float}, {float})` is not an iterator
--> src/demo.rs:103:27
|
103 | centroids.extend((-90.0, 0.0));
| ------ ^^^^^^^^^^^^ `({float}, {float})` is not an iterator
| |
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `({float}, {float})`
= note: required for `({float}, {float})` to implement `IntoIterator`
note: required by a bound in `extend`
--> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/collect.rs:368:5
This is somewhat logical, but it would be handy to have an alternative. I would like to collect a series of tuples (and other non-iterable types) in an order structure. Is this at all possible with the Vec type? Or would there be a more appropriate collection type?