The Rust Programming Language Forum
Declaring a global vector in rust
cole-miller
March 3, 2022, 2:54pm
2
Does this suit your needs?
const STRINGS: &[&str] = &["str1", "str2"];
show post in topic
Related topics
Topic
Replies
Views
Activity
Create a vector of constants, outside main
14
1466
November 17, 2024
Initialize an immutable global variable without locks
help
27
1480
November 25, 2025
How to make it global?
help
7
417
January 25, 2024
What's the idiomatic way to store array of global constant objects?
help
9
11158
December 25, 2017
Best way to have an immutable global array/Vec of &str/String loaded from a file at compile-time?
help
4
1231
March 17, 2018