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
pub struct Equal<T1, T2>(pub T1, pub T2);
impl Equal<&[u8], &[u8]> {
pub const fn const_eval(&self) -> bool {
crate::bytes::equal(self.0, self.1)
}
}
impl<const L1: usize, const L2: usize> Equal<&[u8; L1], &[u8; L2]> {
pub const fn const_eval(&self) -> bool {
crate::bytes::equal(self.0, self.1)
}
}
impl Equal<&str, &str> {
pub const fn const_eval(&self) -> bool {
crate::str::equal(self.0, self.1)
}
}
#[macro_export]
macro_rules! equal {
($lhs: expr, $rhs: expr) => {
$crate::__ctfe::Equal($lhs, $rhs).const_eval()
};
}