1.5.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
Apache-2.0 - Apache License 2.0Provides a macro, assert_matches
, which tests whether a value
matches a given pattern, causing a panic if the match fails.
#[macro_use] extern crate assert_matches;
#[derive(Debug)]
enum Foo {
A(i32),
B(i32),
}
let a = Foo::A(1);
assert_matches!(a, Foo::A(_));
assert_matches!(a, Foo::A(i) if i > 0);
To include in your project, only when tests are compiled, add the following to your Cargo.toml:
[dev-dependencies]
assert_matches = "1.5"
And add the following to your crate root:
#[cfg(test)] #[macro_use]
extern crate assert_matches;
assert_matches
is distributed under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.