Expand description
Shell-compatible wildcard matching for Rust — part of the cross-language shwild family.
shwild provides shell-style pattern matching: literals, ? (any one
character), * (any number of characters), […] ranges, [^…]
not-ranges, escapes, and case flags. shwild.Rust is a port with
minimal API differences from the original C/C++ library; the design
emphasis is simplicity-of-use, modularity, and performance.
(See shwild.Go for the Go implementation.)
§Installation
Reference in Cargo.toml in the usual way:
shwild = { version = "0.1" }§Components
matches()— parsepatternand testinputin one step;shwild_matches!— shorthand formatches()(2- or 3-arg);CompiledMatcher— parse once, match many times;ErrorandResult— parse/match error reporting;IGNORE_CASE— flag for case-insensitive matching;
§Features
lookup-ranges(default) — range matching via collect-rsUnicodePointMap;null-feature— no effect; useful for driver scripts;test-regex— optional regex dependency for benchmarks and scratch programs;
§Examples
use shwild::shwild_matches;
assert_eq!(Ok(true), shwild_matches!("*.rs", "lib.rs"));Further examples are in the repository examples directory and in the project README.
Macros§
- shwild_
matches - Defines the macro
shwild_matches!().
Structs§
- Compiled
Matcher - Type that holds a compiled match pattern, against which multiple strings may be evaluated.
Enums§
- Error
- Represents parsing result.
Constants§
- IGNORE_
CASE - Causes matching to ignore case.
Functions§
- matches
- Determines whether the given
inputmatches the givenpattern, according to the givenflags.