misunderstand the implements verb (#18)

* Update 08_from.md

* test

* Update exercises/04_traits/08_from/src/lib.rs

---------

Co-authored-by: datewu <hihahajun@gmail.com>
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
This commit is contained in:
taohua 2024-05-18 23:56:39 +08:00 committed by GitHub
parent 1d9ba4c25c
commit 44f3260fbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -105,7 +105,7 @@ though the former bound is implicit.
In [`std`'s documentation](https://doc.rust-lang.org/std/convert/trait.From.html#implementors)
you can see which `std` types implement the `From` trait.
You'll find that `&str` implements `From<&str> for String`. Thus, we can write:
You'll find that `String` implements `From<&str> for String`. Thus, we can write:
```rust
let title = String::from("A title");
@ -129,7 +129,7 @@ where
}
```
If a type `T` implements `From<U>`, then `Into<U> for T` is automatically implemented. That's why
If a type `U` implements `From<T>`, then `Into<U> for T` is automatically implemented. That's why
we can write `let title = "A title".into();`.
## `.into()`

View file

@ -1,4 +1,4 @@
// TODO: Implement the `From` trait for the `u32` type to make `example` compile.
// TODO: Implement the `From` trait for the `WrappingU32` type to make `example` compile.
pub struct WrappingU32 {
value: u32,