disjoint_impls 1.3.6

Support for mutually disjoint impls
Documentation
use disjoint_impls::disjoint_impls;

disjoint_impls! {
    pub trait Kita<T>
    where
        T: Default,
    {
        type GenericAssociatedType<GAT>;

        fn kita<GAT>(_: Self::GenericAssociatedType<GAT>) -> &'static str;
    }

    impl<T: Default, R> Kita<T> for R
    where
        R: std::ops::Deref<Target = str>,
    {
        type GenericAssociatedType<GAT> = GAT;

        fn kita<GAT>(_: Self::GenericAssociatedType<GAT>) -> &'static str {
            "Blanket"
        }
    }
}

/*
pub trait Kita<T>
where
    T: Default,
{
    type GenericAssociatedType<GAT>;
    fn kita<GAT>(_: Self::GenericAssociatedType<GAT>) -> &'static str;
}

const _: () = {
    impl<T: Default, R> Kita<T> for R
    where
        R: std::ops::Deref<Target = str>,
    {
        type GenericAssociatedType<GAT> = GAT;
        fn kita<GAT>(_: Self::GenericAssociatedType<GAT>) -> &'static str {
            "Blanket"
        }
    }
};
*/

#[test]
fn single_impl() {
    assert_eq!("Blanket", <String as Kita<u32>>::kita(12));
    assert_eq!("Blanket", <Box<str> as Kita<String>>::kita(12));
}