AnyTrait
This is a no_std crate that lets you cast from:
- your concrete type
&dyn AnyTraitto:- the concrete type
- any other trait implemented by your type
&dyn AnyTrait
If the trait implements AnyTrait, that too can be cast to:
- the concrete type
- any other trait implemented by your type
&dyn AnyTrait
This is not zero-cost, since at any cast we need to go through the list of all possible subtraits.
This will (almost) enable you to do OOP in rust, but if this is your goal we still ask you to kindly reconsider
example usage:
use ;
// if a trait implements `AnyTrait` you can upi/downcast
// must include all traits you want to downcast to