Examples
========
Proc-macro flavour 🤖
---------------------
Most of the time you will want to use the proc-macro.
* [`with_proc_macro`](with_proc_macro.rs) || [`with_proc_macro_enum`](with_proc_macro_enum.rs): Simplest use case for this crate.
* [`with_proc_macro_generic_target`](with_proc_macro_generic_target.rs): Shows that the proc-macro supports casting to concrete generic traits.
* [`with_proc_macro_mut`](with_proc_macro_mut.rs): Shows how to downcast mutably.
Decl-macro flavour 🖨️
---------------------
The decl-macro is slightly more powerful than the proc-macro.
It adds support for concrete generic structs/enums/unions.
* [`with_decl_macro`](with_decl_macro.rs): Simplest use case for the decl-macro.
Note: Also possible with the proc-macro. See [`with_proc_macro`](with_proc_macro.rs).
* [`with_decl_macro_generic_struct`](with_decl_macro_generic_struct.rs): Shows that the decl-macro supports concrete generic structs/enums/unions.
Note: This is not possible with the proc-macro.
Manual flavour 📝
-----------------
The manual method requires you to implement the `TraitcastableAny` and `TraitcastableTo` traits yourself.
It is possible to support generic implementations for structs/enums/unions.
Neither proc-macro nor decl-macro support this.
It allows you to optimize the performance by implementing `find_traitcast_target` yourself.
* [`manual`](manual.rs): Simplest manual implementation.
* [`manual_generic_struct`](manual_generic_struct.rs): Shows how to support generic implementations for structs/enums/unions.