pub enum MyOption {
Some(i32),
None,
}
Basic usage:
enum Option{
Some(i32),
None,
}
let s = Some(42);
assert_eq!(s.unwrap(), 42);
match s {
Some(n) => println!("num is: {}", n),
None => (),
};Run
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)