[−][src]Macro intertrait_macros::castable_to
castable_to!() { /* proc-macro */ }
Declare target traits for casting implemented by a type.
This macro is for registering both a concrete type and its traits to be targets for casting. Useful when the type definition and the trait implementations are in an external crate.
Note: this macro cannot be used in an expression or statement due to the current limitation in the stable Rust.
Examples
#[derive(std::fmt::Debug)] enum Data { A, B, C } trait Greet { fn greet(&self); } impl Greet for Data { fn greet(&self) { println!("Hello"); } } castable_to! { Data: std::fmt::Debug, Greet }