Skip to main content

Crate shwild

Crate shwild 

Source
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

§Features

  • lookup-ranges (default) — range matching via collect-rs UnicodePointMap;
  • 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§

CompiledMatcher
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 input matches the given pattern, according to the given flags.

Type Aliases§

Result
A specialized Result type for shwild.