We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for freestanding associated types, i.e. types that don't comprise id like here:
use disjoint_impls::disjoint_impls; pub trait Dispatch { type Group; } pub enum GroupA {} impl Dispatch for (u16, u32) { type Group = GroupA; } impl Dispatch for (i16, i32) { type Group = GroupA; } pub enum GroupB {} impl Dispatch for (i32, String) { type Group = GroupB; } impl Dispatch for (u32, String) { type Group = GroupB; } trait A { type B; } disjoint_impls! { pub trait Kita<U: A<B = u32>> { const NAME: &'static str; } impl<T, U, C> Kita<(U, C)> for T where (U, C): Dispatch<Group = GroupA> + A<B = u32> { const NAME: &'static str = "1st blanket A"; } impl<T, U, C> Kita<(U, C)> for T where (U, C): Dispatch<Group = GroupB> + A<B = u32> { const NAME: &'static str = "1st blanket B"; } impl<T: Dispatch<Group = GroupA>> Kita<(i32,)> for T { const NAME: &'static str = "2nd blanket A"; } impl<T: Dispatch<Group = GroupB>> Kita<(i32,)> for T { const NAME: &'static str = "2nd blanket B"; } } impl A for (i32,) { type B = u32; } fn main() { assert_eq!("Blanket A", <u32 as Kita<(u16, u32)>>::NAME); }
This is associated type in trait definition. What if associated type is in the impl?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Add support for freestanding associated types, i.e. types that don't comprise id like here:
This is associated type in trait definition. What if associated type is in the impl?
The text was updated successfully, but these errors were encountered: