I want to create a function (for a library) that will output a structure for any CSV that contains all the columns and their data. This means that column names (unless explicitly specified by the user) will not be known until runtime.
Can I create a structure definition at run time or modify an existing structure? If so, how?
For example, how can I mutate the following structure structure:
struct Point {
x: String,
y: String,
}
To the following (only in memory):
struct Point {
x: String,
y: String,
z: String,
}
This behavior is possible in languages like Python, but I'm not sure if this is possible in compiled languages like Rust.
source
share