4 ms·
Except is not the same thing? You can copy a reference, you can't copy a box (without having the T be copy as well). A box is a pointer AND the storage at the
by eddd-ddde 2y ago
Except is not the same thing? You can copy a reference, you can't copy a box (without having the T be copy as well).
A box is a pointer AND the storage at the same time. To move it means to move the storage as well, unlike a regular reference.
- remram 2y ago> A box is a pointer AND the storage at the same time. That's just the way you decide to see it. Most people don't, in fact the actual documentation is quite different: >> A pointer type that uniquely owns a heap allocation of type T. This explicitly describes it as a pointer, pointing to a single allocation. https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html