Creating vec! in compile time in Rust but in different files

Suppose I want to get a list of things from my app through command line:

command_line.value("get_things").is_some() {
    println!("{}", vec!["a", "b", "c"])
}

Now suppose that this list of things is spread over the app files like this:

file1.rs:

add_thing("a");

file2.rs:

add_thing("b");

file3.rs:

add_thing("c");

However, this list has to be constructed in compile time, not in runtime. Is this possible in Rust? So when the program starts, the list is already available.

https://github.com/dtolnay/linkme

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.