fff-query-parser 0.6.0

Query parser for fff file finder - includes specific syntax for various constraints like globs, extensions, regex etc
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Glob wildcard detection — delegates to zlob when available, pure-Rust fallback otherwise.
//!
//! All call sites use a single function: `has_wildcards(text) -> bool`.
//! When the `zlob` feature is enabled this calls `zlob::has_wildcards` with
//! `ZlobFlags::RECOMMENDED`; without it we check for the same set of wildcard
//! characters (`*`, `?`, `[`, `{`) in pure Rust.

#[cfg(feature = "zlob")]
#[inline]
pub fn has_wildcards(s: &str) -> bool {
    zlob::has_wildcards(s, zlob::ZlobFlags::RECOMMENDED)
}

#[cfg(not(feature = "zlob"))]
#[inline]
pub fn has_wildcards(s: &str) -> bool {
    s.bytes().any(|b| matches!(b, b'*' | b'?' | b'[' | b'{'))
}