created db crate

This commit is contained in:
2020-11-10 10:56:31 -07:00
parent 6350f421a1
commit 4650e84111
3 changed files with 36 additions and 0 deletions

View File

@@ -7,3 +7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
db = { path = "db" }

9
db/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "db"
version = "0.1.0"
authors = ["Jon Janzen <jon@endofeternity.ca>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

26
db/src/lib.rs Normal file
View File

@@ -0,0 +1,26 @@
struct DBHeader {
magic: u8,
major_version: u8, // actually u4 in data
minor_version: u8, // actually u4 in data
reserved: u16,
record_count: u32,
}
struct RecordHeader {
field_count: u8,
length: u8,
crc: u16,
}
struct Field {
field_type: u8,
value: String,
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}