I have some code that takes an iterator defined by a crate and consumes it. I've narrowed the bug in my project down to something to do with the type signature, with a very constrained example of the fix here.
What does this compiler error mean, and why is it fixed by changing the type signature of the outer function? It doesn't change the fact that the
Iterator trait has always been implemented for the given type, so I'm confused why this is a 'trait not implemented' error instead of a 'expected type Foo, got type Bar' error.
error[E0599]: no method named `next` found for type `rusqlite::row::MappedRows<'_, F>` in the current scope --> src/main.rs:5:7 | 5 | m.next().unwrap() | ^^^^ | = note: the method `next` exists but the following trait bounds were not satisfied: `rusqlite::row::MappedRows<'_, F> : std::iter::Iterator` error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. error: Could not compile `iterators`. To learn more, run the command again with --verbose.
Type in question is defined here