PatternHunt

Struct PatternHunt 

Source
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

Source

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 match
  • roots - Array of root directories to search in
  • opts - 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();
Source

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 match
  • roots - Array of root directories to search in
  • opts - 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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.