[][src]Function libjess::fs::ls_dir

pub fn ls_dir<C, E>(
    path: impl AsRef<Path>,
    cb: &mut C,
    cb_err: &mut E
) -> Result<()> where
    C: FnMut(&DirEntry),
    E: FnMut(&WrappedError), 

List entries in the specified directory by iterating on the std::fs::read_dir iterator.

Calls cb when then iterator yields a DirEntry, otherwise calls cb_err with the error

Errors

See error section on std::fs::read_dir

Examples

Iterate over entries in a directory, printing their path to stdout

use libjess::prelude::v1::*;
let _ = ls_dir(".",
    &mut |dir_entry| println!("{:?}", dir_entry.path()),
    &mut |err| eprintln!("{:?}", err),
);