Option is an enum that represents an optional value, containing either Some(T) for a value or None for absence. You handle it by matching on its variants to extract the value or handle the missing case.
fn plus_one(x: Option<i32>) -> Option<i32> {
match x {
None => None,
Some(i) => Some(i + 1),
}
}
let five = Some(5);
let six = plus_one(five);
let none = plus_one(None);