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"];
4 Likes
show post in topic
Related topics
Topic
Replies
Views
Activity
Create a vector of constants, outside main
15
605
February 15, 2025
How to make it global?
help
8
232
April 24, 2024
What's the idiomatic way to store array of global constant objects?
help
10
10798
January 12, 2023
Best way to have an immutable global array/Vec of &str/String loaded from a file at compile-time?
help
5
959
January 12, 2023
[SOLVED] What pattern would you suggest for caching since there's no concept of global heap variables in rust?
29
7081
January 12, 2023