fn scan_items(state: &mut AppState, p: impl AsRef<Path>) {
    for entry in fs::read_dir(p).expect("cannot access all dir") {
        let entry = entry.expect("error scanning all dir");
        let path = entry.path();
        let cpath = path.canonicalize().unwrap();
        let filename = entry.file_name();
        state.items_all.insert(
            cpath,
            Item {
                name: filename.to_string_lossy().to_string(),
                filename: filename,
                tags: HashSet::default(),
            },
        );
    }
}
/// Add files from given directory to items index
Add files from given directory to items index
Add files from given directory to items index
fn scan_items(state: &mut AppState, p: impl AsRef<Path>) {
    for entry in fs::read_dir(p).expect("cannot access all dir") {
        let entry = entry.expect("error scanning all dir");
        let path = entry.path();
        let cpath = path.canonicalize().unwrap();
        let filename = entry.file_name();
        state.items_all.insert(
            cpath,
            Item {
                name: filename.to_string_lossy().to_string(),
                filename: filename,
                tags: HashSet::default(),
            },
        );
    }
}
fn scan_items ( state : & mut AppState , p : impl AsRef < Path > ) { for entry in fs :: read_dir ( p ) . expect ( " " ) { let entry = entry . expect ( " " ) ; let path = entry . path ( ) ; let cpath = path . canonicalize ( ) . unwrap ( ) ; let filename = entry . file_name ( ) ; state . items_all . insert ( cpath , Item { name : filename . to_string_lossy ( ) . to_string ( ) , filename : filename , tags : HashSet :: default ( ) , } , ) ; } }
Add files from given directory to items index
Add files from given directory to items index
state
&mut AppState
p
impl AsRef<Path>