crates.io
...To add a literal ] do "[]abc]" {e} = doesn't return a value, but matches end of line. Use this if you don't want to ignore potential extra characters at end of input. Examples: {[0-9ab]} = match 0-9 or a or b {[^,.]} = match anything but , or . {/.../} = return regex inside...
Crate
v0.2.6
2021-02-21
docs.rs
...grok The grok library allows you to quickly parse and match potentially unstructured data into a structed result. It is especially helpful when parsing logfiles of all kinds. This Rust version is mainly a port from the Java version which in turn drew inspiration from the original Ruby version . Usage...
Crate
v2.4.1
2026-03-19
docs.rs
...assert!(specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(x86_win), Predicate::TargetFeature(feat) => avail_target_feats.contains(feat), Predicate::Feature(feat) => *feat == "cool_thing", _ => false, } })); // This will *not* satisfy the vendor predicate assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(uwp_win), Predicate::TargetFeature...
Crate
v0.20.8
2026-05-29
docs.rs
Support for matching file paths against Unix shell style patterns.
glob Support for matching file paths against Unix shell style patterns. Documentation Usage To use glob , add this to your Cargo.toml : [dependencies] glob = "0.3.2" Examples Print all jpg files in /media/ and all of its subdirectories. use...
Crate
v0.3.4
2026-07-21
crates.io
...String, } } // disabled variant is matched let config = toml::from_str::<Config>(r#" [feature] enabled = false "#).unwrap(); assert!(matches!(config.feature, FeatureConfig::Disabled { .. })); // if the type used `enabled: bool`, this would cause issues and require Option<_> wrappers plus // further validation... instead an error is returned immediately regarding the missing fields let...
Crate
v0.1.5
2026-07-21
crates.io
...States can defer an event to their superstate by returning the Super outcome. #[state(superstate = "blinking")] fn led_on(event: &Event) -> Outcome<State> { match event { Event::TimerElapsed => Transition(State::led_off()), Event::ButtonPressed => Super } } #[superstate] fn blinking(event: &Event) -> Outcome<State> { match event { Event::ButtonPressed => Transition(State::not_blinking()), _ => Super...
Crate
v0.4.0
2025-07-05
crates.io
...States can defer an event to their superstate by returning the Super outcome. #[state(superstate = "blinking")] fn led_on(event: &Event) -> Outcome<State> { match event { Event::TimerElapsed => Transition(State::led_off()), Event::ButtonPressed => Super } } #[superstate] fn blinking(event: &Event) -> Outcome<State> { match event { Event::ButtonPressed => Transition(State::not_blinking()), _ => Super...
Crate
v0.4.1
2025-07-05
docs.rs
...end() Match end of input. any() Match any symbol and return the symbol. sym(t) Match a single terminal symbol t . seq(s) Match sequence of symbols. list(p,s) Match list of p , separated by s . one_of(set) Success when current input symbol is one of the set...
Crate
v3.4.0
2024-03-06
docs.rs
...Each bit in the bitmap indicates a bit matching pattern: bit 0 1 2 3 4 5 6 7 match * 0* 1* 00* 01* 10* 11* 000* bit 8 9 10 11 12 13 14 15 match 001* 010* 011* 100* 101* 110* 111* endnode-bit The last bit here...
Crate
v0.5.0
2020-03-30
docs.rs
...import re re.compile('(a|b|ab)*bc').match('ab' * 28 + 'ac') In Python (tested on both 2.7 and 3.5), this match takes 91s, and doubles for each additional repeat of 'ab'. Thus, many proponents advocate a purely NFA (nondeterministic finite automaton) based approach. Even so, backreferences and...
Crate
v0.19.0
2026-07-28
docs.rs
...u32 = match <u32 as TryFrom<u8>>::try_from(42) { | Ok(it) => it, | Err(unreachable) => unreachable, // Error, expected `u32`, found `Infallible` }; but the following doesn't! use ::never_say_never::Never; let x: u32 = match Ok::<_, Never>(42) { | Ok(it) => it, | Err(unreachable) => unreachable, };
Crate
v6.6.666
2022-01-19
docs.rs
...use croner::Cron; use chrono::Local; fn main() { // Parse cron expression let cron_all = Cron::from_str("18 * * * 5") .expect("Couldn't parse cron string"); // Compare cron pattern with current local time let time = Local::now(); let matches_all = cron_all.is_time_matching(&time).unwrap(); // Get next match let...
Crate
v3.0.1
2025-10-27
docs.rs
...String) -> Result<i32, exitcode::ExitCode> { match s.parse::<i32>() { Ok(i) => Ok(i), Err(_) => Err(exitcode::USAGE) } } pub fn main() { match parse_int_or_return_error_exitcode("123".to_string()) { Ok(i) => println!("Parsed: {}", i), Err(code) => { println!("Parse error. Exiting with code: {}", code); process::exit(code); } } match parse_int...
Crate
v1.1.2
2017-06-18
docs.rs
...For full details read the docs on docs.rs This crate provides helper types for matching against enum variants, and extracting bindings to each of the fields in the deriving Struct or Enum in a generic way. If you are writing a #[derive] which needs to perform some operation on...
Crate
v0.14.0
2026-07-30
docs.rs
...let status = reqwest::get(format!("{}/missing", &mock_server.uri())) .await .unwrap() .status(); assert_eq!(status.as_u16(), 404); } Matchers wiremock provides a set of matching strategies out of the box - check the matchers module for a complete list. You can define your own matchers using the Match trait, as well...
Crate
v0.6.5
2025-08-24
crates.io
...The actual results will vary depending on the inputs, but here is a taster based on "a".repeat(40) as an input and various modes (nothing matched, everything matched and replaced, everything matched from the start and deleted): params .replace (ns) .cow_replace (ns) difference (%) ("a", "") 408.59 290.27...
Crate
v0.1.3
2023-09-26
docs.rs
...BuildMetadata::EMPTY, }; assert!(!req.matches(&version)); // Check whether it matches 1.3.0 (yes it does) let version = Version::parse("1.3.0").unwrap(); assert!(req.matches(&version)); } Scope of this crate Besides Cargo, several other package ecosystems and package managers for other languages also use SemVer: RubyGems/Bundler for...
Crate
v1.0.28
2026-04-04
docs.sru-systems.com
...use argon2::{self, Config}; let password = b"password"; let salt = b"randomsalt"; let config = Config::default(); let hash = argon2::hash_encoded(password, salt, &config).unwrap(); let matches = argon2::verify_encoded(&hash, password).unwrap(); assert!(matches); Create a password hash with custom settings and verify it: use argon2::{self, Config, ThreadMode...
Crate
v3.0.0
2025-07-17
crates.io
Emulate macro-rules pattern matching in procedural macros proc-macro-rules macro_rules -style syntax matching for procedural macros. This crate is work-in-progress, incomplete, and probably buggy! Example: rules!(tokens => { ($finish:ident ($($found:ident)*) # [ $($inner:tt)* ] $($rest:tt)*) => { for f in found { do_something(finish, f, inner, rest...
Crate
v0.4.0
2023-11-07
crates.io
Unicode caseless matching rust-caseless Unicode caseless matching
Crate
v0.2.2
2024-12-30