3 ms·
The purpose is to enter the if block if and only if the pattern is matched. In your example, if "need_explicit_dep_argument_path" matches enum "DepArgumentRequi
by nu11ptr 4y ago
The purpose is to enter the if block if and only if the pattern is matched. In your example, if "need_explicit_dep_argument_path" matches enum "DepArgumentRequirePath::NotNeeded" the if block will be entered (else it will be skipped). This is a bit of an atypical example as there are no bindings in the pattern match, but most times there are, and they are then scoped within the if block. For example:
let my_option = Some("test");
if let Some(my_str) = my_option {
println!("I matched this string: {my_str}");
}