Destructuring Arrays

๋ฐฐ์—ญ ์—ญ์‹œ ๋ถ„ํ•ด๊ฐ€ ๊ฐ€๋Šฅํ•˜๊ณ , ์Šฌ๋ผ์ด์Šค๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

You can destructure arrays, tuples, and slices by matching on their elements:

#[rustfmt::skip]
fn main() {
    let triple = [0, -2, 3];
    println!("Tell me about {triple:?}");
    match triple {
        [0, y, z] => println!("First is 0, y = {y}, and z = {z}"),
        [1, ..]   => println!("First is 1 and the rest were ignored"),
        _         => println!("All elements were ignored"),
    }
}