[][src]Crate dbase

dbase is rust library ment to read (writing coming later) .dbf file.

Reading

To Read the whole file at once you should use the read function.

Once you have access to the records, you will have to match against the real FieldValue

Examples

use dbase::FieldValue;
let records = dbase::read("tests/data/line.dbf").unwrap();
for record in records {
    for (name, value) in record {
        println!("{} -> {:?}", name, value);
        match value {
            FieldValue::Character(string) => println!("Got string: {}", string),
            FieldValue::Numeric(value) => println!("Got numeric value of  {}", value),
            _ => {}
        }
    }
}

You can also create a Reader and iterate over the records.

let reader = dbase::Reader::from_path("tests/data/line.dbf").unwrap();
for record_result in reader {
    let record = record_result.unwrap();
    for (name, value) in record {
        println!("name: {}, value: {:?}", name, value);
    }
}

Structs

Reader

Struct with the handle to the source .dbf file Responsible for reading the content

Enums

Error

Errors that may happen when reading a .dbf

FieldValue

Enum where each variant stores the record value

Functions

read

One liner to read the content of a .dbf file

Type Definitions

Record

Type definition of a record. A .dbf file is composed of many records