The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Process A Directory Recursitvely In Rust

TODO: Pull subtitle into page object
Code
use walkdir::{DirEntry, WalkDir};

fn is_not_hidden(entry: &DirEntry) -> bool {
    entry
        .file_name()
        .to_str()
        .map(|s| entry.depth() == 0 || !s.starts_with("."))
        .unwrap_or(false)
}

fn main() {
    WalkDir::new(".")
        .into_iter()
        .filter_entry(|e| is_not_hidden(e))
        .filter_map(|v| v.ok())
        .for_each(|x| println!("{}", x.path().display()));
}








Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Process A Directory Recursitvely In Rust

This is a stright copy from The Rust Cookbook^rcb^^. 
It hits all files that aren't hidden (i.e. that don't
start with a `.``)

-- code
-- rust

use walkdir::{DirEntry, WalkDir};

fn is_not_hidden(entry: &DirEntry) -> bool {
    entry
        .file_name()
        .to_str()
        .map(|s| entry.depth() == 0 || !s.starts_with("."))
        .unwrap_or(false)
}

fn main() {
    WalkDir::new(".")
        .into_iter()
        .filter_entry(|e| is_not_hidden(e))
        .filter_map(|v| v.ok())
        .for_each(|x| println!("{}", x.path().display()));
}










-- ref
-- The Rust Cookbook - Traverse directories while skipping dotfiles 
-- url: https://rust-lang-nursery.github.io/rust-cookbook/file/dir.html#traverse-directories-while-skipping-dotfiles


-- blurb

-- categories
-- Rust 

-- metadata
-- date: 2023-05-04 17:21:55
-- id: 2pltmjun
-- site: aws
-- type: post
-- status: published