基本类型可以通过类型转换相互转换。
Rust 通过使用trait来处理自定义类型(即struct和enum)之间的转换。泛型转换将使用From和Into trait。然而,对于更常见的情况,特别是当转换到和从String时,有更具体的方法。
struct
enum
From
Into
String