Skip to content

Instantly share code, notes, and snippets.

@craig-bishop
Last active December 17, 2016 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craig-bishop/78df35fd42213cd15ddb51d842b2dd8d to your computer and use it in GitHub Desktop.
Save craig-bishop/78df35fd42213cd15ddb51d842b2dd8d to your computer and use it in GitHub Desktop.
fn convert_to_complex<'a, I>(polygons: I) -> Vec<ComplexPolygon>
where I: Iterator<Item = &'a [(i32, i32)]>,
I: Clone
{
...
}
...
static TEST_VERTS: &'static [&'static [(i32, i32)]] =
&[&[(0, 0), (40, 0), (40, 40), (0, 40)],
&[(10, 10), (30, 10), (30, 30), (10, 30)],
&[(5, 5), (5, 35), (35, 35), (35, 5)],
&[(15, 15), (15, 25), (25, 25), (25, 15)]];
let result = convert_to_complex(TEST_VERTS.into_iter());
...
error[E0271]: type mismatch resolving `<std::slice::Iter<'_, &[(i32, i32)]> as std::iter::Iterator>::Item == &[(i32, i32)]`
--> src/format.rs:100:22
|
100 | let result = convert_to_complex(TEST_VERTS.into_iter());
| ^^^^^^^^^^^^^^^^^^ expected reference, found slice
|
= note: expected type `&&[(i32, i32)]`
= note: found type `&[(i32, i32)]`
= note: required by `format::convert_to_complex`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment