min-specialization

Rust's specialization feature allows you to provide a default implementation of a trait for generic types and then specialize it for specific types. This feature is currently unstable and only available on the nightly version of Rust.
This crate emulates Rust's #[feature(min_specialization)] unstable feature on stable Rust.
Example
Annotate a module with #[specialization]. Inside it, write a trait, one
blanket implementation that provides the default behaviour (its specializable
methods are marked default), and any number of concrete implementations that
override those methods for specific types:
use specialization;
A more complex example
A blanket impl can have several specializations, including ones for borrowed
types such as &str (which TypeId-based dispatch normally forbids, since it
requires 'static). Associated types are defined once by the blanket impl and
shared by every specialization — only methods are specialized. Dispatch happens
at run time and picks the most specific matching impl:
use specialization;
use Describe;
assert_eq!; // specialized
assert_eq!; // specialized
assert_eq!; // specialized (borrowed type)
assert_eq!; // blanket default
Specialization also supports generic methods (including const generics),
generic associated types (GATs), trait lifetime parameters, and non-trivial
argument patterns; see tests for more.