created db crate
This commit is contained in:
@@ -7,3 +7,4 @@ edition = "2018"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
db = { path = "db" }
|
||||||
9
db/Cargo.toml
Normal file
9
db/Cargo.toml
Normal 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
26
db/src/lib.rs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user