Recursive generator in Rust causing “recursive type” error; workaround?
问题 I have a construct of the form: pub enum Value { Nil, Str(String), Seq(Vec<Value>), } A Value is either null, a string, or a vector of other Value s, which can then in turn be any of the three options. I'd like to make a method that lazily iterates over each String in a Value , respecting nesting. My first attempt looks something like this: #![feature(generators)] #![feature(generator_trait)] use std::ops::{Generator, GeneratorState}; use std::pin::Pin; fn gen_to_iter<G>(g: G) -> impl