docs.rs
A macro to evaluate, as a boolean, whether an expression matches a pattern. A macro to evaluate, as a boolean, whether an expression matches a pattern. For users who build using only Rust 1.42 and newer, consider using std::matches , which is included in the standard library prelude and...
Crate
v0.1.10
2023-01-21
docs.rs
Cross platform single glob and glob set matching. Glob set matching is the
process of matching one or more glob patterns against a single candidate path
simultaneously, and returning all of the globs that matched.
globset Cross platform single glob and glob set matching. Glob set matching is the process...
Crate
v0.4.20
2026-08-04
docs.rs
...The matches are tried in order. The first matches get priority over later ones, even if later ones are perfect matches. let x = 123i32; let result = spez! { for x; match<T> T where i8: From<T> -> i32 { 0 } match<T: std::fmt::Debug> T -> i32 { 1 } match i32 -> i32 { 2...
Crate
v0.1.2
2023-04-26
crates.io
An extremely fast glob matcher glob-match An extremely fast glob matching library with support for wildcards, character classes, and brace expansion. Linear time matching. No exponential backtracking. Zero allocations. No regex compilation. Matching occurs on the glob pattern in place. Support for capturing matched ranges of wildcards. Thousands of...
Crate
v0.2.1
2023-02-07
docs.rs
Asserts that a value matches a pattern assert_matches Provides a macro, assert_matches , which tests whether a value matches a given pattern, causing a panic if the match fails. Documentation #[macro_use] extern crate assert_matches; #[derive(Debug)] enum Foo { A(i32), B(i32), } let a = Foo::A(1...
Crate
v1.5.0
2021-02-05
docs.rs
Wildcard matching wildcard wildcard is a rust crate for wildcard matching. Here's how to use it: let wildcard = Wildcard::new("*foo?*bar".as_bytes()).unwrap(); assert!(wildcard.is_match("fooofooobar".as_bytes())); Special characters can be escaped to represent their literal symbol: let wildcard = Wildcard::new(r"\*\?".as_bytes...
Crate
v0.3.0
2024-11-14
github.com
...Each match includes the pattern that matched along with the byte offsets of the match. use aho_corasick::{AhoCorasick, PatternID}; let patterns = &["apple", "maple", "Snapple"]; let haystack = "Nobody likes maple in their apple flavored Snapple."; let ac = AhoCorasick::new(patterns).unwrap(); let mut matches = vec![]; for mat in ac.find...
Crate
v1.1.5
2026-08-03
docs.rs
...Usage let matcher = regex_filtered::Builder::new() .push("foo")? .push("bar")? .push("baz")? .push("quux")? .build()?; assert!(matcher.is_match("bar")); assert_eq!(matcher.matching("baz").count(), 1); assert_eq!(matcher.matching("foo quux").count(), 2); # Ok::<(), Box<dyn std::error::Error>>(()) [ Regexes::is_match ] returns whether any pattern in...
Crate
v0.2.1
2026-03-22
crates.io
Simple string matching with single- and multi-character wildcard operator. wildmatch Match strings against a simple wildcard pattern. Tests a wildcard pattern p against an input string s . Returns true only when p matches the entirety of s . See also the example described on wikipedia for matching wildcards. ? matches exactly...
Crate
v2.6.1
2025-11-14
crates.io
...let mut router = Router::new(); router.insert("/{{hello}}", true)?; router.insert("/{hello}", true)?; // Match the static route. let matched = router.at("/{hello}")?; assert!(matched.params.is_empty()); // Match the dynamic route. let matched = router.at("/hello")?; assert_eq!(matched.params.get("hello"), Some("hello")); Conflict Rules Static and dynamic route...
Crate
v0.9.2
2026-04-08
crates.io
...extern crate clap; extern crate sys_mount; use clap::{App, Arg}; use sys_mount::{Mount, MountFlags, SupportedFilesystems}; use std::process::exit; fn main() { let matches = App::new("mount") .arg(Arg::with_name("source").required(true)) .arg(Arg::with_name("directory").required(true)) .get_matches(); let src = matches.value_of("source...
Crate
v3.1.0
2026-01-29
docs.rs
...Structured like match statement, the first matching
branch is the item that gets emitted.
match_cfg Documentation Minimum Supported Rust Version : 1.13.0. A convenience macro to ergonomically define an item depending on a large number of #[cfg] parameters. Structured like match statement, the first matching branch is the...
Crate
v0.1.0
2019-04-02
docs.rs
Fuzzy Matching Library Fuzzy Matcher Fuzzy matching algorithm(s) in Rust! Usage In your Cargo.toml add the following: [dependencies] fuzzy-matcher = "*" Here are some code example: use fuzzy_matcher::FuzzyMatcher; use fuzzy_matcher::skim::SkimMatcherV2; let matcher = SkimMatcherV2::default(); assert_eq!(None, matcher.fuzzy_match("abc", "abx")); assert!(matcher...
Crate
v0.3.7
2020-10-04
docs.rs
...let matches: Vec<_> = set.matches("foobar").into_iter().collect(); assert_eq!(matches, vec![0, 2, 3, 4, 6]); // You can also test whether a particular regex matched: let matches = set.matches("foobar"); assert!(!matches.matched(5)); assert!(matches.matched(6)); Usage: regex internals as a library The regex-automata directory...
Crate
v1.13.1
2026-07-15
crates.io
Statically assert that a type matches another type assert_type_match A niche utility macro to statically assert that a type matches another type. Purpose The primary purpose of this crate is to make copying and pasting types from other crates into your own more future-proof by statically asserting...
Crate
v0.1.1
2024-09-23
docs.rs
Regex matching on character and byte streams.
matchers Regular expression matching on Rust streams. Overview The regex crate implements regular expression matching on strings and byte arrays. However, in order to match the output of implementations of fmt::Debug and fmt::Display , or by any code which writes to an...
Crate
v0.2.0
2024-07-01
docs.rs
...clap_complete_command::Shell, }, } fn main() { let cli = Cli::parse(); match cli.command { // e.g. `$ cli completions bash` Commands::Completions { shell } => { shell.generate(&mut Cli::command(), &mut std::io::stdout()); } } } Builder use clap::{Arg, Command}; fn build_cli() -> Command { Command::new(env!("CARGO_PKG_NAME")) .subcommand_required(true) .subcommand( Command...
Crate
v0.6.1
2024-07-14
crates.io
...Test a match let b = regex_is_match!("[ab]+", "car"); assert_eq!(b, true); let b = bytes_regex_is_match!("[ab]+", b"car"); assert_eq!(b, true); See regex_is_match! Extract a value let f_word = regex_find!(r"\bf\w+\b", "The fox jumps."); assert_eq!(f_word...
Crate
v3.6.1
2026-07-29
github.com
...Exact match search The method finds a value associated with an exact match key as a Option . Requirements Rust version >= 1.58.0 Usage See also example code for more details. Build a double-array trie use yada::builder::DoubleArrayBuilder; // make a keyset which have key-value pairs let keyset...
Crate
v0.7.0
2026-06-06
github.com
...builder.push("🍣", 7); let mut trie = builder.build(); // exact_match(): Find a word exactly match to query. assert_eq!(trie.exact_match("すし"), Some(&6)); assert_eq!(trie.exact_match("🍣"), Some(&7)); assert_eq!(trie.exact_match("🍜"), None); // Values can be modified. let v = trie.exact_match_mut("🍣").unwrap(); *v...
Crate
v0.4.2
2024-05-12