src/tuples-and-arrays/destructuring.md
Rust supports using pattern matching to destructure a larger value like a tuple into its constituent parts:
# // Copyright 2023 Google LLC
# // SPDX-License-Identifier: Apache-2.0
#
fn check_order(tuple: (i32, i32, i32)) -> bool {
let (left, middle, right) = tuple;
left < middle && middle < right
}
fn main() {
let tuple = (1, 5, 3);
println!(
"{tuple:?}: {}",
if check_order(tuple) { "ordered" } else { "unordered" }
);
}
= has the same structure as
the pattern.let to declare a single variable.