Open Infiziert90 opened 3 years ago
I'll try to look into that
In the csv-library it is possible to define the Record-type:
//tutorial-read-serde-03.rs
use std::collections::HashMap;
// This introduces a type alias so that we can conveniently reference our
// record type.
type Record = HashMap<String, String>;
fn run() -> Result<(), Box<Error>> {
let mut rdr = csv::Reader::from_reader(io::stdin());
for result in rdr.deserialize() {
let record: Record = result?;
println!("{:?}", record);
}
Ok(())
}
Maybe we can have something similar?
There is already something close to this https://docs.rs/dbase/0.2.0/dbase/#deserialisation
I think the feature requested here is more about changing a filed type rather than that serialization.
Changing a field type should be doable by reading the file, changing the types in the Record and create the appropriate writer. The things is can it be made a bit simpler ?
Yeah that's exactly what I meant.
Where this idea comes from is easy.... In the company I work for we use the old DOS program "DBase" this program allows it you to edit .dbf files both header and body
So you have for example the field Name: XYZ Type: Character Length: 20 Precision: 0
And now you can go and change that "Type" to "Numeric" and the program would create a new dbf file with the correct header and changed body values
Is it possible to get support for changing the type of a field?
For example: The .dbf file has a "Numeric" field that would be changed into a "Character" field