Function fs_extra::dir::ls [] [src]

pub fn ls<P>(path: P, config: &HashSet<DirEntryAttr>) -> Result<LsResult> where
    P: AsRef<Path>, 

Returned collection directory entries with information which you choose in config.

This function takes to arguments:

  • path - Path to directory.

  • config - Set attributes which you want see inside return data.


This function will return an error in the following situations, but is not limited to just these cases:

  • This path directory does not exist.
  • Invalid path.
  • The current process does not have the permission rights to access path.


Be careful when using this code, it's not being tested!
extern crate fs_extra;
use fs_extra::dir::{ls, DirEntryAttr, LsResult};
use std::collections::HashSet;

let mut config = HashSet::new();

let result = ls("test", &config);
assert_eq!(2, ls_result.items.len());
assert_eq!(2, ls_result.base.len());