2 releases

0.1.1 Aug 24, 2021
0.1.0 Aug 24, 2021

#26 in #ensure


Used in tupleops

ISC OR MIT OR Apache-2.0

6KB

Ensure that two types are the same, or fail with a compilation error.

use same_types::assert_same_types;

assert_same_types!(u32, u32, u32, u32);
use same_types::assert_same_types;

// Fails with the message:
// the trait `SameTypes` is not implemented for `(i32, u32)`
assert_same_types!(u32, u32, i32, u32);

lib.rs:

Ensure that two types are the same, or fail with a compilation error.

use same_types::assert_same_types;

assert_same_types!(u32, u32, u32, u32);
use same_types::assert_same_types;

// Fails with the message:
// the trait `SameTypes` is not implemented for `(i32, u32)`
assert_same_types!(u32, u32, i32, u32);

No runtime deps