1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-02-04 18:36:01 +02:00

Fix typo in box.md (#2362)

This commit is contained in:
xrdelectro 2024-09-12 17:53:54 +03:00 committed by GitHub
parent 5aa08d489f
commit 3637c44a5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,8 +68,8 @@ fn main() {
- `Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be not
null.
- A `Box` can be useful when you:
- have a type whose size that can't be known at compile time, but the Rust
compiler wants to know an exact size.
- have a type whose size can't be known at compile time, but the Rust compiler
wants to know an exact size.
- want to transfer ownership of a large amount of data. To avoid copying large
amounts of data on the stack, instead store the data on the heap in a `Box`
so only the pointer is moved.