use std::*;
type Result<T> = std::io::Result<T>;
#[cfg(feature = "wildcard")]
pub fn include(wildcard: &'static str) -> impl Fn(&fs::DirEntry) -> bool {
let wildcard = wc::Wildcard::new(wildcard.as_bytes()).unwrap();
move |entry| wildcard.is_match(entry.file_name().as_encoded_bytes())
}
#[cfg(feature = "wildcard")]
pub fn exclude(wildcard: &'static str) -> impl Fn(&fs::DirEntry) -> bool {
let wildcard = wc::Wildcard::new(wildcard.as_bytes()).unwrap();
move |entry| !wildcard.is_match(entry.file_name().as_encoded_bytes())
}
pub fn files(entry: &fs::DirEntry) -> bool {
if let Ok(file_type) = entry.file_type() {
file_type.is_file()
} else {
false
}
}
pub fn dirs(entry: &fs::DirEntry) -> bool {
if let Ok(file_type) = entry.file_type() {
file_type.is_dir()
} else {
false
}
}
pub fn symlink(entry: &fs::DirEntry) -> bool {
if let Ok(file_type) = entry.file_type() {
file_type.is_symlink()
} else {
false
}
}