5.8 Array Type: Fixed-Length Homogeneous Collections
Right, arrays. Let’s talk about the workhorse, the trusty (if sometimes rigid) container that you’ll use more often than you’ll check your email. An array is the simplest way to say, “I need exactly N things of exactly the same type, and I want them right next to each other in memory.” It’s a fixed-length, homogeneous collection. Let’s unpack that jargon. Fixed-length means you declare its size upfront and that’s it. No take-backsies. The array’s length is part of its type signature. A [i32; 5] is a completely different and distinct type from a [i32; 6]. This is Rust being its usual brutally honest self with the compiler: it needs to know exactly how much stack space to allocate for your array, and it can’t do that if the size might change.