Macro downcast::impl_downcast

source ·
macro_rules! impl_downcast {
    (<$($params:ident),+ $(,)*> $base:ty $(where $($bounds:tt)+)*) => { ... };
    ($base:ty) => { ... };
}
Expand description

Implements Downcast for your trait-object-type.

impl_downcast!(Foo);
impl_downcast!(<B> Foo<B> where B: Bar);
impl_downcast!(<B> Foo<Bar = B>);

expands to

impl<T> Downcast<T> for Foo
    where T: Any
{}

impl<T, B> Downcast<T> for Foo<B>
    where T: Any, B: Bar
{}

impl<T, B> Downcast<T> for Foo<Bar = B>
    where T: Any
{}