Consider this example:
const TARGET_DIRECTORY: &'static str = "files";
const INDEX_FILE_PATH: &'static str = TARGET_DIRECTORY + "/index.txt"; // Should resolve to "files/index.txt"
This falters since the string on the left (TARGET_DIRECTORY) needs to be a String in order to use the + operator. One might try invoking TARGET_DIRECTORY.to_owned(), but that can't be executed at compilation.
I found the constcat crate right after posting. There's other ones but this one is the simplest and smallest one. I'll mark this as an answer in 2 days.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With