-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1329 from second-state/type-cast
Improve the conversion example
- Loading branch information
Showing
2 changed files
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
# Conversion | ||
|
||
Rust addresses conversion between types by the use of [traits]. The generic | ||
Primitive types can be converted to each other through [casting]. | ||
|
||
Rust addresses conversion between custom types (i.e., `struct` and `enum`) | ||
by the use of [traits]. The generic | ||
conversions will use the [`From`] and [`Into`] traits. However there are more | ||
specific ones for the more common cases, in particular when converting to and | ||
from `String`s. | ||
|
||
[casting]: types/cast.md | ||
[traits]: trait.md | ||
[`From`]: https://doc.rust-lang.org/std/convert/trait.From.html | ||
[`Into`]: https://doc.rust-lang.org/std/convert/trait.Into.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters