fff_query_parser/glob_detect.rs
1//! Glob wildcard detection — delegates to zlob when available, pure-Rust fallback otherwise.
2//!
3//! All call sites use a single function: `has_wildcards(text) -> bool`.
4//! When the `zlob` feature is enabled this calls `zlob::has_wildcards` with
5//! `ZlobFlags::RECOMMENDED`; without it we check for the same set of wildcard
6//! characters (`*`, `?`, `[`, `{`) in pure Rust.
7
8#[cfg(feature = "zlob")]
9#[inline]
10pub fn has_wildcards(s: &str) -> bool {
11 zlob::has_wildcards(s, zlob::ZlobFlags::RECOMMENDED)
12}
13
14#[cfg(not(feature = "zlob"))]
15#[inline]
16pub fn has_wildcards(s: &str) -> bool {
17 s.bytes().any(|b| matches!(b, b'*' | b'?' | b'[' | b'{'))
18}