Rust: how to combine iter(), iter::once(), and iter::empty()?
Advertisements The following code works: let a = [1, 2, 3].iter(); let b = iter::once(&456); for i in a.chain(b) { println!("{}", i); } Output: 1 2 3 456 But now, I need to change b (depending on some condition) to be either iter() or iter::once , e.g. let a = [1, 2, 3].iter(); let b… Read More Rust: how to combine iter(), iter::once(), and iter::empty()?