Macro cglue_macro::as_mut

source ·
as_mut!() { /* proc-macro */ }
Expand description

Checked cast to a list of optional traits.

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

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

as_mut! is non-final, meaning once the reference is dropped, the original group object can be used.

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.