Post #2612507
2023-12-02 21:21 UTC
@luna@lunar.place I think in the case of `&Box` deref coercion happens under the hood, so yes it works too, but in the end the method is called on `&dyn ...`, not &Box.
Simple example to show that one can call trait object methods on &Box (via automatic deref coercion):
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b1cb5a760c46da62bca9be0e1a8d28f5
Replies (1)
-
@janriemer@floss.social 2023-12-02 21:29
@luna@lunar.place About deref coercion from the official Rust docs https://doc.rust-lang.org/book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods