From 4650e841119c043dda1b56ceb4b849707dea5832 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Tue, 10 Nov 2020 10:56:31 -0700 Subject: [PATCH] created db crate --- Cargo.toml | 1 + db/Cargo.toml | 9 +++++++++ db/src/lib.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 db/Cargo.toml create mode 100644 db/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 5fbc86e..f85077a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } \ No newline at end of file diff --git a/db/Cargo.toml b/db/Cargo.toml new file mode 100644 index 0000000..b85f1d6 --- /dev/null +++ b/db/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "db" +version = "0.1.0" +authors = ["Jon Janzen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/db/src/lib.rs b/db/src/lib.rs new file mode 100644 index 0000000..8fd15ea --- /dev/null +++ b/db/src/lib.rs @@ -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); + } +}