Macro cglue::cast[][src]

cast!() { /* proc-macro */ }
Expand description

Checked cast to a list of optional traits.

The syntax is similar to a cast expression, but uses impl keyword:

cast!(obj impl Trait1 + Trait2 + Trait3);

cast! is non-final, meaning it is possible to cast back to the base group object.

This macro accepts either:

  1. A list of optional traits, without any mandatory traits.

or

  1. A list of optional traits, with every mandatory trait.

In either case a successfully cast object will still implement the mandatory traits.