std-module
std::option — represent missing data
The module contains Option and its supporting iterator types. Choose it for expected absence, such as a search with no match; it does not carry an explanation of failure. Option and its variants are normally in the prelude. Expected stdout (not executed): Some(8) Common mistake: Using a magic number such as -1 to stand for a missing value when -1 can also be valid.
Formal Syntax & Structure
rust syntaxrust
use std::option::Option;Working Example
Example Snippetrust
fn main() { let found = [4, 8, 12].iter().find(|&&n| n == 8); println!("{found:?}");}