Generator like functionality for Rust lang