1 stable release
1.0.3 | Oct 3, 2021 |
---|---|
1.0.2 |
|
#2058 in Rust patterns
3KB
Use
It's like a match, but it returns an Option
let to_match = "hello world";
let opt = match_start! {to_match,
"hello" | "something" => "something else"
"world" | "another" => "another thing"
};
if let Some(value) = opt {
println!("{}", value); // Will print "something else"
}