mod filter;
pub mod glob;
mod glob_path;
mod ignore;
mod walker;
pub use filter::{FilterResult, IncludeExclude};
pub use glob::{contains_glob, expand_braces, glob_match};
pub use glob_path::{GlobPath, PathSegment, PatternError};
pub use ignore::IgnoreFilter;
pub use walker::{EntryTypes, ErrorCallback, FileWalker, WalkOptions};
use async_trait::async_trait;
use std::path::{Path, PathBuf};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum WalkerError {
#[error("not found: {0}")]
NotFound(String),
#[error("permission denied: {0}")]
PermissionDenied(String),
#[error("io error: {0}")]
Io(String),
#[error("symlink cycle detected: {0}")]
SymlinkCycle(String),
}
#[async_trait]
pub trait WalkerFs: Send + Sync {
type DirEntry: WalkerDirEntry;
async fn list_dir(&self, path: &Path) -> Result<Vec<Self::DirEntry>, WalkerError>;
async fn read_file(&self, path: &Path) -> Result<Vec<u8>, WalkerError>;
async fn is_dir(&self, path: &Path) -> bool;
async fn exists(&self, path: &Path) -> bool;
async fn canonicalize(&self, path: &Path) -> PathBuf {
path.to_path_buf()
}
}
pub trait WalkerDirEntry: Send {
fn name(&self) -> &str;
fn is_dir(&self) -> bool;
fn is_file(&self) -> bool;
fn is_symlink(&self) -> bool;
}