1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2021 René Kijewski <rene.[SURNAME]@fu-berlin.de>
// All rights reserved.
//
// This software and the accompanying materials are made available under
// the terms of the ISC License which is available in the project root as LICENSE-ISC, AND/OR
// the terms of the MIT License which is available at in the project root as LICENSE-MIT, AND/OR
// the terms of the Apache License, Version 2.0 which is available in the project root as LICENSE-APACHE.
//
// You have to accept AT LEAST one of the aforementioned licenses to use, copy, modify, and/or distribute this software.
// At your will you may redistribute the software under the terms of only one, two, or all three of the aforementioned licenses.
//! 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);
//! ```
//!
//! ```compile_fail
//! 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);
//! ```
use PhantomData;
/// Helper trait for [assert_same_types] to tell if two types are exactly the same.
/// Helper function for [assert_same_types] to tell if two types are exactly the same.
pub const
/// Assert that two or more types are exactly the same. Compilation error otherwise.
///
/// ```
/// use same_types::assert_same_types;
///
/// assert_same_types!(u32, u32, u32, u32);
/// ```
///
/// ```compile_fail
/// use same_types::assert_same_types;
///
/// assert_same_types!(u32, u32, i32, u32);
/// ```