use std::fmt::Debug;
use enumerable::Enumerable;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Enumerable)]
enum EnumA {
A,
B,
C,
}
#[rustfmt::skip]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Enumerable)]
enum EnumB where {
Y,
Z,
}
#[derive(Clone, Copy, Debug, Enumerable)]
struct GenericStruct<T, U> {
t: T,
u: U,
}
#[derive(Clone, Copy, Debug, Enumerable)]
enum GenericEnum<T: PartialOrd + Debug, U: PartialEq = T, V: PartialEq<T> = T>
where
T: Enumerable + Eq,
U: Eq,
{
A(T),
B(U),
C(Result<(T, U), (bool, V)>),
}
fn main() {
println!(
"All possible values of GenericStruct<bool, EnumA> ({} in total):",
GenericStruct::<bool, EnumA>::ENUMERABLE_SIZE
);
for gs in GenericStruct::<bool, EnumA>::enumerator() {
println!("{:?}", gs);
}
println!();
println!(
"All possible values of GenericStruct<EnumB, bool> ({} in total):",
GenericStruct::<EnumB, bool>::ENUMERABLE_SIZE
);
for gs in GenericStruct::<EnumB, bool>::enumerator() {
println!("{:?}", gs);
}
println!();
println!(
"All possible values of GenericEnum<bool> ({} in total):",
GenericEnum::<bool>::ENUMERABLE_SIZE
);
for ge in GenericEnum::<bool>::enumerator() {
println!("{:?}", ge);
}
println!(
"All possible values of GenericEnum<bool, EnumA> ({} in total):",
GenericEnum::<bool, EnumA>::ENUMERABLE_SIZE
);
for ge in GenericEnum::<bool, EnumA>::enumerator() {
println!("{:?}", ge);
}
println!(
"All possible values of GenericEnum<EnumB, bool, EnumB> ({} in total):",
GenericEnum::<EnumB, bool, EnumB>::ENUMERABLE_SIZE
);
for ge in GenericEnum::<EnumB, bool, EnumB>::enumerator() {
println!("{:?}", ge);
}
}