Re:What's in the Box?
by brundolf on Monday April 19, 2021 @08:07PM
(#26869267)
You're basically correct. Everything in Rust is value-typed by default. A Box<> puts a value type on the heap (makes it a reference type). The difference from a normal reference type is that a Box is owned (in Rust ownership terms), where other references aren't. Both normal references and boxes can be typed as dyn Trait which means they dynamic-dispatch method calls based on some trait, instead of statically dispatching them to the concrete type.
[ Parent
| on HN ]
There are no comments on this comment yet.