I want to create a function (for a library) which will output a struct for any CSV which contains all the columns and their data. This means that the column names (unless explicitly provided by the user) will not be known until runtime.
Is it possible to create a struct definition at runtime or mutate an existing struct? If so, how?
For example, how can I mutate the following struct structure:
struct Point {
x: String,
y: String,
}
To the following (in memory only):
struct Point {
x: String,
y: String,
z: String,
}
This behaviour is possible in languages such as Python, but I am not sure if it is possible in compiled languages such as Rust.