mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 15:56:28 +00:00
feat(errors5): add simpler explanation for box dyn
This commit is contained in:
parent
977a167335
commit
af301a2efe
2 changed files with 3 additions and 1 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -459,7 +459,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustlings"
|
name = "rustlings"
|
||||||
version = "4.8.0"
|
version = "5.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argh",
|
"argh",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the
|
// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the
|
||||||
// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like.
|
// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like.
|
||||||
|
// For now, think of the `Box<dyn ...>` type as an "I want anything that does ???" type, which, given
|
||||||
|
// Rust's usual standards for runtime safety, should strike you as somewhat lenient!
|
||||||
|
|
||||||
// In short, this particular use case for boxes is for when you want to own a value and you care only that it is a
|
// In short, this particular use case for boxes is for when you want to own a value and you care only that it is a
|
||||||
// type which implements a particular trait. To do so, The Box is declared as of type Box<dyn Trait> where Trait is the trait
|
// type which implements a particular trait. To do so, The Box is declared as of type Box<dyn Trait> where Trait is the trait
|
||||||
|
|
Loading…
Reference in a new issue