1#![no_std]
9
10use core::marker::PhantomData;
11
12pub trait Truth {}
13
14pub struct BoolConstant<const VALUE: bool>;
15impl Truth for BoolConstant<true> {}
16
17pub struct Same<T, U>(PhantomData<T>, PhantomData<U>);
18
19#[allow(clippy::mismatching_type_param_order)]
20impl<T> Truth for Same<T, T> {}
21
22pub trait AssociatedType {
23 type Type;
24}
25
26pub struct Conditional<const COND: bool, T, F>(PhantomData<T>, PhantomData<F>);
27
28impl<T, F> AssociatedType for Conditional<true, T, F> {
29 type Type = T;
30}
31
32impl<T, F> AssociatedType for Conditional<false, T, F> {
33 type Type = F;
34}
35
36pub type ConditionalType<const COND: bool, T, F> = <Conditional<COND, T, F> as AssociatedType>::Type;
37
38pub struct EnableIf<const COND: bool, T>(PhantomData<T>);
39
40impl<T> AssociatedType for EnableIf<true, T> {
41 type Type = T;
42}
43
44pub type EnableIfType<const COND: bool, T> = <EnableIf<COND, T> as AssociatedType>::Type;