match
Rust 通过 match 关键字提供模式匹配,类似于 C 语言的 switch。第一个匹配的分支会被求值,并且必须覆盖所有可能的值。
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 通过 match 关键字提供模式匹配,类似于 C 语言的 switch。第一个匹配的分支会被求值,并且必须覆盖所有可能的值。