Note This question contains syntax that predates Rust 1.0. The code is invalid, but the concepts are still relevant.
How do you create a global static array of strings in Rust?
For integers, this compiles:
static ONE:u8 = 1;
static TWO:u8 = 2;
static ONETWO:[&'static u8, ..2] = [&ONE, &TWO];
But I can't get something similar for strings to compile:
static STRHELLO:&'static str = "Hello";
static STRWORLD:&'static str = "World";
static ARR:[&'static str, ..2] = [STRHELLO,STRWORLD]; // Error: Cannot refer to the interior of another static
question from:
https://stackoverflow.com/questions/27459640/how-to-create-a-static-array-of-strings 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…