Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

类型转换

Rust 使用 trait 解决类型之间的转换问题。最一般的转换会用到 FromInto 两个 trait。不过,即便常见的情况也可能会用到特别的 trait,尤其是从 String 转换到别的类型,以及把别的类型转换到 String 时。