use disjoint_impls::disjoint_impls; pub trait Dispatch { type Group; } pub enum GroupA {} impl Dispatch for String { type Group = GroupA; } impl Dispatch for Vec { type Group = GroupA; } pub enum GroupB {} impl Dispatch for i32 { type Group = GroupB; } impl Dispatch for u32 { type Group = GroupB; } disjoint_impls! { pub trait Kita: Dispatch where U: From + From { const NAME: &'static str; } impl> Kita for T where U: From + From { const NAME: &'static str = "Blanket A"; } impl> Kita for T where U: From + From { const NAME: &'static str = "Blanket B"; } } /* pub trait Kita: Dispatch where U: From + From, { const NAME: &'static str; } const _: () = { pub trait _Kita0<_1: ?Sized, U>: Dispatch where U: From + From { const NAME: &'static str; } impl<_0, _1: Dispatch> _Kita0 for _1 where _0: From + From { const NAME: &'static str = "Blanket A"; } impl<_0, _1: Dispatch> _Kita0 for _1 where _0: From + From { const NAME: &'static str = "Blanket B"; } impl<_0, _1> Kita<_0> for _1 where _0: From + From, _1: Dispatch, Self: _Kita0<<_1 as Dispatch>::Group, _0> { const NAME: &'static str = ::Group, _0>>::NAME; } }; */ #[test] fn extra_parameter() { assert_eq!("Blanket A", >::NAME); assert_eq!("Blanket A", as Kita>::NAME); assert_eq!("Blanket B", >::NAME); assert_eq!("Blanket B", >::NAME); }