Hi,
Situation is the following: I want to compile an executable with an array located in a separate txt file. The way I am doing it now is to put placeholders and have a third tool that reads both the source and the txt and utilized regex to creates a merged new source file that is then executed by calling a system cmd cargo run
Example:
main.rs
fn main(){
let array: [i32; XXX] = [VVV];
}
file.txt
XXX= 5
VVV= 1 2 3 4 5
and then my parser reads main + file.txt and substitutes it with:
main.rs
fn main(){
let array: [i32; 5] = [1,2,3,4,5];
}
Is there a more elegant way to do this without using vectors and system calls ? The point is to get values inside the main in order to produce a new binary with values compiled... Any suggestions?
m