the.bay.news

Learning Rust: recursive directories scan

The Rust Programming Language Forum
Learning Rust: recursive directories scan
When I just started learning Rust, I wrote the below function: fn recurse_dirs(path: &Path, parent: Option<&String>) -> io::Result<JsonStr> { let meta = path.metadata()?; let mut buf = JsonStr::with_capacity(256); if meta.is_dir() && path.file_name().unwrap().to_str() != Some(".git") { let dirs: Vec<_> = read_dir(path)? .filter_map(|f| match f { Ok(f) if f.file_type().map(|t| t.is_dir()).unwrap_or_default() ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.