#util

is-match

Library to check whether something matches something else

1 unstable release

0.1.0 May 3, 2017

#10 in #util

Download history 6933/week @ 2019-03-25 6891/week @ 2019-04-01 8269/week @ 2019-04-08 6351/week @ 2019-04-15 6479/week @ 2019-04-22 6760/week @ 2019-04-29 6118/week @ 2019-05-06 6155/week @ 2019-05-13 8438/week @ 2019-05-20 10598/week @ 2019-05-27 10272/week @ 2019-06-03 10905/week @ 2019-06-10 10935/week @ 2019-06-17 8820/week @ 2019-06-24 7041/week @ 2019-07-01

31,673 downloads per month
Used in 79 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