#utils #matches #whether #check

is-match

Library to check whether something matches something else

1 unstable release

Uses old Rust 2015

0.1.0 May 3, 2017

#13 in #matches

Download history 218/week @ 2024-01-25 156/week @ 2024-02-01 263/week @ 2024-02-08 319/week @ 2024-02-15 295/week @ 2024-02-22 295/week @ 2024-02-29 315/week @ 2024-03-07 211/week @ 2024-03-14 401/week @ 2024-03-21 447/week @ 2024-03-28 259/week @ 2024-04-04 277/week @ 2024-04-11 309/week @ 2024-04-18 270/week @ 2024-04-25 289/week @ 2024-05-02 288/week @ 2024-05-09

1,172 downloads per month
Used in 89 crates (10 directly)

MPL-2.0 license

7KB

is-match

A mini crate to check whether something matches something else:

let value = some_function_call();

if is_match!(value, Ok(Some(EnumFoo::ComplexThing { Some(_), .. })) | Ok(Some(EnumFoo::Bar(_)))) {
  /* do things */
}

License

This project was extracted from imag at commit c74c26ccd143d905c94ecf84ac423293b7170623 where only I was the author of this file. imag itself is licensed as LGPL2.1, but I'm relicensing this piece of code as MPL 2.0 here.

See LICENSE - MPL 2.0

No runtime deps