macro_rules! traitcast {
(struct $type:ty) => { ... };
(struct $type:ty : $($trait:ident),+) => { ... };
(impl $trait:ident for $source:ty) => { ... };
($source:ty => $target:ty) => { ... };
}
Expand description
traitcast!(struct Bar)
registers a struct to allow it to be cast into.
traitcast!(impl Foo for Bar)
allows casting into dynamic Foo
trait
objects, from objects whose concrete type is Bar
.
traitcast!(struct Bar: Foo1, Foo2)
registers a struct to allow it to be
cast into, and further allows casting into dynamic Foo1
or Foo2
trait
objects, from objects whose concrete type is Bar
.