Description
I'm trying to learn Rust, I'm trying to write a function to calculate the frequency of letters in a string. I figure I'll start with a mutable 256-element array initialised to zeroes and increment the correct field as I go along.
Reading the "Vectors" section of the Rust Guide, it tells me how to create a literal array:
let nums = [1i, 2i, 3i];
...and even mentions the abbreviated syntax for the type of such an array:
let nums: [int, ..3] = [1i, 2i, 3i];
...but it doesn't mention that there's an abbreviated syntax for initialising an array.
It's possible the Guide is not the right place for this information, but it also wasn't mentioned in Rust By Example. It is mentioned in the language Reference Manual, but that document isn't necessarily aimed at beginners, and I didn't find it until I'd asked in #rust
, found out the answer, and then searched for it specifically.