In this section, we'll take a look at some of the advanced usage of match and let patterns. First, let's look at match.
Advanced match patterns and guards
Match guards
We can also use match guards on arms (if code > 400 || code <= 500) to match on a subset of values. They start with an if expression.
Advanced let destructure
We have the following complex data that we want to match against:
// complex_destructure.rs
enum Foo {
One, Two, Three
}
enum Bar(Foo);
struct Dummy {
inner: Bar
}
struct ComplexStruct {
obj: Dummy
}
fn get_complex_struct() ->...