as_ref!() { /* 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_ref!(obj impl Trait1 + Trait2 + Trait3);
as_ref!
is non-final, meaning once the reference is dropped, the original group object can be
used mutably.
This macro accepts either:
- A list of optional traits, without any mandatory traits.
or
- A list of optional traits, with every mandatory trait.
In either case a successfully cast object will still implement the mandatory traits.