2 ms·
In that particular example you won't get boxes of boxes- `baz` gets instantiated for each impl of `Baz`, so the call to `self.foo()` is resolved statically and
by Rusky 7y ago
In that particular example you won't get boxes of boxes- `baz` gets instantiated for each impl of `Baz`, so the call to `self.foo()` is resolved statically and the return type is fully known.
- ogoffart 7y agoDepends on the (not-yet-implemented) implementation of async functions in traits. But currently, with the async_trait macro, there is only one version of Foo::foo, and it returns a Box<...>. But it is true we could imagine the compiler generating two versions: one for when the static type is known, and one if dynamic dispatch is used.