pub struct DirectoryHandle { child_paths: Vec, finished: bool, } impl DirectoryHandle { pub fn get_files(&mut self) -> Result, String> { if self.finished { Err("Could not find more files.".to_string()) } else { self.finished = true; Ok(self.child_paths.clone()) } } pub fn new(childs: Vec) -> DirectoryHandle { DirectoryHandle { child_paths: childs, finished: false, } } }