#util

is-match

Library to check whether something matches something else

1 unstable release

Uses old Rust 2015

0.1.0 May 3, 2017

#47 in #util

Download history 758/week @ 2023-02-02 704/week @ 2023-02-09 881/week @ 2023-02-16 1203/week @ 2023-02-23 552/week @ 2023-03-02 564/week @ 2023-03-09 585/week @ 2023-03-16 425/week @ 2023-03-23 738/week @ 2023-03-30 465/week @ 2023-04-06 370/week @ 2023-04-13 428/week @ 2023-04-20 646/week @ 2023-04-27 459/week @ 2023-05-04 482/week @ 2023-05-11 400/week @ 2023-05-18

2,061 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