Macro downcast_rs::impl_downcast [−][src]
macro_rules! impl_downcast { (@impl_full $trait_:ident [$($param_types:tt)*] for [$($forall_types:ident),*] where [$($preds:tt)*] ) => { ... }; (@impl_full_sync $trait_:ident [$($param_types:tt)*] for [$($forall_types:ident),*] where [$($preds:tt)*] ) => { ... }; (@impl_body $trait_:ident [$($types:tt)*]) => { ... }; (@impl_body_sync $trait_:ident [$($types:tt)*]) => { ... }; (@inject_where [$($before:tt)*] types [] where [] [$($after:tt)*]) => { ... }; (@inject_where [$($before:tt)*] types [$($types:ident),*] where [] [$($after:tt)*]) => { ... }; (@inject_where [$($before:tt)*] types [$($types:ident),*] where [$($preds:tt)+] [$($after:tt)*]) => { ... }; (@as_item $i:item) => { ... }; ($trait_:ident ) => { ... }; ($trait_:ident <>) => { ... }; (sync $trait_:ident ) => { ... }; (sync $trait_:ident <>) => { ... }; ($trait_:ident < $($types:ident),* >) => { ... }; (sync $trait_:ident < $($types:ident),* >) => { ... }; ($trait_:ident < $($types:ident),* > where $($preds:tt)+) => { ... }; (sync $trait_:ident < $($types:ident),* > where $($preds:tt)+) => { ... }; ($trait_:ident assoc $($atypes:ident),*) => { ... }; (sync $trait_:ident assoc $($atypes:ident),*) => { ... }; ($trait_:ident assoc $($atypes:ident),* where $($preds:tt)+) => { ... }; (sync $trait_:ident assoc $($atypes:ident),* where $($preds:tt)+) => { ... }; ($trait_:ident < $($types:ident),* > assoc $($atypes:ident),*) => { ... }; (sync $trait_:ident < $($types:ident),* > assoc $($atypes:ident),*) => { ... }; ($trait_:ident < $($types:ident),* > assoc $($atypes:ident),* where $($preds:tt)+) => { ... }; (sync $trait_:ident < $($types:ident),* > assoc $($atypes:ident),* where $($preds:tt)+) => { ... }; (concrete $trait_:ident < $($types:ident),* >) => { ... }; (sync concrete $trait_:ident < $($types:ident),* >) => { ... }; (concrete $trait_:ident assoc $($atypes:ident = $aty:ty),*) => { ... }; (sync concrete $trait_:ident assoc $($atypes:ident = $aty:ty),*) => { ... }; (concrete $trait_:ident < $($types:ident),* > assoc $($atypes:ident = $aty:ty),*) => { ... }; (sync concrete $trait_:ident < $($types:ident),* > assoc $($atypes:ident = $aty:ty),*) => { ... }; }
Adds downcasting support to traits that extend downcast::Downcast
by defining forwarding
methods to the corresponding implementations on std::any::Any
in the standard library.
See https://users.rust-lang.org/t/how-to-create-a-macro-to-impl-a-provided-type-parametrized-trait/5289 for why this is implemented this way to support templatized traits.