pub struct PatternHunt;Expand description
Main facade for the PatternHunt library
This struct provides high-level APIs for both synchronous and asynchronous file globbing with pattern matching.
Implementations§
Source§impl PatternHunt
impl PatternHunt
Sourcepub fn sync(
patterns: &[&str],
roots: &[&str],
opts: GlobOptions,
) -> Result<Vec<PathBuf>, GlobError>
pub fn sync( patterns: &[&str], roots: &[&str], opts: GlobOptions, ) -> Result<Vec<PathBuf>, GlobError>
Performs synchronous glob pattern matching
This method searches for files matching the specified patterns in the given root directories, with configurable options.
§Arguments
patterns- Array of pattern strings to matchroots- Array of root directories to search inopts- Configuration options for globbing
§Returns
Ok(Vec<PathBuf>) with matching paths, or Err(GlobError) on failure
§Examples
use patternhunt::{PatternHunt, GlobOptions};
let options = GlobOptions::default();
let results = PatternHunt::sync(
&["*.txt", "*.md"],
&["."],
options
).unwrap();Sourcepub fn stream(
patterns: &[&str],
_roots: &[&str],
opts: GlobOptions,
) -> Result<impl Stream<Item = Result<PathBuf, GlobError>>, GlobError>
pub fn stream( patterns: &[&str], _roots: &[&str], opts: GlobOptions, ) -> Result<impl Stream<Item = Result<PathBuf, GlobError>>, GlobError>
Creates a stream of results for asynchronous glob pattern matching
This method returns a stream that asynchronously yields matching paths, suitable for use with async runtimes like Tokio.
§Arguments
patterns- Array of pattern strings to matchroots- Array of root directories to search inopts- Configuration options for globbing
§Returns
Ok(impl Stream<Item = Result<PathBuf, GlobError>>) on success,
or Err(GlobError) if pattern compilation fails
§Note
Currently supports single-root operations. For multiple roots, consumers should call this method for each root directory.