Rust tips is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Rust tips @rust

`if let` of multiple values?

There can be only one `let`, but it can be a tuple that expects multiple things. This is equivalent of `a && b`:

if let (Some(a), Some(b)) = (a, b) {}

For `a || b` you can use the `.or()` method of `Option` and `Result`:

if let Some(a_or_b) = a.or(b) {}

Try it: is.gd/SJNWQG

· Web · 1 · 0