Attribute Macro dyn_dyn_impl

Source
#[dyn_dyn_impl]
Expand description

Marks an impl block as targeting a trait that was declared with the #[dyn_dyn_base] attribute.

This attribute allows the impl block to specify what other traits should be exposed for downcasting via the base trait that’s being implemented in this block.

§Examples

#[dyn_dyn_base]
trait Base {}

#[derive(Debug)]
struct Struct;

#[dyn_dyn_impl(Debug)]
impl Base for Struct {}
#[dyn_dyn_base]
trait Base {}
trait Trait<T> {}

struct Struct<T>(T);

impl<T> Trait<T> for Struct<T> {}

#[dyn_dyn_impl(Trait<T>)]
impl<T: 'static> Base for Struct<T> {}