]> git.proxmox.com Git - rustc.git/blame - src/doc/rust-by-example/src/conversion.md
New upstream version 1.44.1+dfsg1
[rustc.git] / src / doc / rust-by-example / src / conversion.md
CommitLineData
2c00a5a8
XL
1# Conversion
2
ba9703b0
XL
3Primitive types can be converted to each other through [casting].
4
5Rust addresses conversion between custom types (i.e., `struct` and `enum`)
6by the use of [traits]. The generic
2c00a5a8
XL
7conversions will use the [`From`] and [`Into`] traits. However there are more
8specific ones for the more common cases, in particular when converting to and
9from `String`s.
10
ba9703b0 11[casting]: types/cast.md
dc9dc135 12[traits]: trait.md
2c00a5a8
XL
13[`From`]: https://doc.rust-lang.org/std/convert/trait.From.html
14[`Into`]: https://doc.rust-lang.org/std/convert/trait.Into.html