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.
Errors
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
.
Examples
extern crate fs_extra; use fs_extra::dir::{ls, DirEntryAttr, LsResult}; use std::collections::HashSet; let mut config = HashSet::new(); config.insert(DirEntryAttr::Name); config.insert(DirEntryAttr::Size); config.insert(DirEntryAttr::BaseInfo); let result = ls("test", &config); assert_eq!(2, ls_result.items.len()); assert_eq!(2, ls_result.base.len());