I have a function that returns an impl Trait
so I don't have access to the concrete return type. I need to use the return value of that function as an associated type in a trait. How do I do that?
Here is a simplified example:
fn f() -> impl Iterator<Item = u8> {
std::iter::empty()
}
struct S;
impl IntoIterator for S {
type Item = u8;
type IntoIter = (); // What can I write here ?
fn into_iter(self) -> Self::IntoIter {
f()
}
}
Is it even possible to do (without resorting to boxing the iterator)?