netstack3_base/
test_only.rs1pub use inner::{TestOnlyFrom, TestOnlyPartialEq};
8
9#[cfg(any(test, feature = "testutils"))]
11mod inner {
12 pub use crate::Counter;
13
14 pub trait TestOnlyPartialEq: PartialEq {}
16
17 impl<T: PartialEq> TestOnlyPartialEq for T {}
18
19 impl PartialEq for Counter {
22 fn eq(&self, _other: &Self) -> bool {
23 panic!("The `Counter` type shouldn't be checked for equality")
24 }
25 }
26
27 pub trait TestOnlyFrom<T>: From<T> {}
29
30 impl<T1, T2: From<T1>> TestOnlyFrom<T1> for T2 {}
31}
32
33#[cfg(not(any(test, feature = "testutils")))]
35mod inner {
36
37 pub trait TestOnlyPartialEq {}
39
40 impl<T> TestOnlyPartialEq for T {}
41
42 pub trait TestOnlyFrom<T> {}
44
45 impl<T1, T2> TestOnlyFrom<T1> for T2 {}
46}