mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
263 B
14 lines
263 B
3 years ago
|
fn main() {
|
||
|
// ANCHOR: here
|
||
|
fn plus_one(x: Option<i32>) -> Option<i32> {
|
||
|
match x {
|
||
|
Some(i) => Some(i + 1),
|
||
|
}
|
||
|
}
|
||
|
// ANCHOR_END: here
|
||
|
|
||
|
let five = Some(5);
|
||
|
let six = plus_one(five);
|
||
|
let none = plus_one(None);
|
||
|
}
|