`GenIter` is panicking after call `.next()` after completion
uselessgoddess opened this issue · comments
Your generator is panicking thread 'main' panicked at 'generator resumed after completion'
let mut generator = gen_iter! {{
yield 1;
}};
println!("{:?}", generator.next());
println!("{:?}", generator.next());
println!("{:?}", generator.next());
It was designed as this, to minimize the memory footprint of GenIter<T>
.
It's recommended to use GenIter<T>
in for loop instead of call next
manually.
@uselessgoddess What if you call .fuse()
on the iterator, does it still panic if you keep calling next
?