Crate will be maintained (at least) until this idiom is allowed by the Rust compiler directly
Description
Enables writing non-overlapping (disjoint) impls distinguished by a set of associated types.
Works for trait and inherent implementations alike (no special syntax).
Trait implementations
use disjoint_impls;
disjoint_impls!
Inherent implementations
use disjoint_impls;
;
disjoint_impls!
Foreign(remote) traits
For traits defined outside the current crate (a.k.a. foreign or remote traits), duplicate
the trait definition inside the macro and annotate it with #[disjoint_impls(remote)].
use disjoint_impls;
// A foreign trait must be brought into scope so
// the `disjoint_impls!` macro can refer to it.
use ForeignKita;
// (orphan rule): You can define blanket impls only
// for types that are defined in the current crate
;
disjoint_impls!
Other, much more complex examples, can be found in tests.