Skip to content

Commit af301a2

Browse files
committed
feat(errors5): add simpler explanation for box dyn
1 parent 977a167 commit af301a2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exercises/error_handling/errors5.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the
66
// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like.
7+
// For now, think of the `Box<dyn ...>` type as an "I want anything that does ???" type, which, given
8+
// Rust's usual standards for runtime safety, should strike you as somewhat lenient!
79

810
// 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
911
// type which implements a particular trait. To do so, The Box is declared as of type Box<dyn Trait> where Trait is the trait

0 commit comments

Comments
 (0)