1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-27 11:08:45 +02:00

Clarify box (#448)

This commit is contained in:
Alexey Sokolov
2023-02-22 15:08:50 +00:00
committed by GitHub
parent bb3b17b6bd
commit e616f66593

View File

@ -31,7 +31,7 @@ from `T` directly on a `Box<T>`][2].
<details> <details>
* `Box` is like `std::unique_ptr` in C++. * `Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be not null.
* In the above example, you can even leave out the `*` in the `println!` statement thanks to `Deref`. * In the above example, you can even leave out the `*` in the `println!` statement thanks to `Deref`.
* A `Box` can be useful when you: * 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 that can't be known at compile time, but the Rust compiler wants to know an exact size.