Skip to content

Commit

Permalink
Add precision on From/Into asymmetry to from_into.md
Browse files Browse the repository at this point in the history
Adding a note to the effect that whilst implementing `From` for a type will provide it w/ `Into`, it doesn't work the other way around: implementing `Into` will not give you `From`.
  • Loading branch information
mckzm authored May 26, 2024
1 parent 2048289 commit fe5aa22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/conversion/from_into.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn main() {
`From` and `Into` are designed to be complementary.
We do not need to provide an implementation for both traits.
If you have implemented the `From` trait for your type, `Into` will call it
when necessary.
when necessary. Note, however, that the converse is not true: implementing `Into` for your type will not automatically provide it with an implementation of `From`.

```rust,editable
use std::convert::From;
Expand Down

0 comments on commit fe5aa22

Please sign in to comment.