Compare commits

...

4 Commits

Author SHA1 Message Date
6350f421a1 DB Format 2020-11-10 10:31:56 -07:00
156710ec53 vscode 2020-11-10 10:08:10 -07:00
3871a1dcb7 merged 2020-11-10 10:07:25 -07:00
c86504ea95 init 2020-11-10 10:06:12 -07:00
5 changed files with 103 additions and 2 deletions

1
.gitignore vendored
View File

@@ -10,4 +10,3 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

45
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,45 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'address_book'",
"cargo": {
"args": [
"build",
"--bin=address_book",
"--package=address_book"
],
"filter": {
"name": "address_book",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'address_book'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=address_book",
"--package=address_book"
],
"filter": {
"name": "address_book",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}

9
Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "address_book"
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]

View File

@@ -1,3 +1,48 @@
# binary_address_book
binary address book from text manipulation chapter
binary address book from text manipulation chapter
# Address Book Fields
Things to store
1. First name(s)
2. Last name
3. Street Address
4. City
5. State/Province
6. Post Code
7. Phone Number
8. Extra
There can be any number of extras
# Binary Format
The binary format for the address book starts with a DB Header. Immediately following the DB Header is the first record header. Each record header is followed by the number of field headers indicated by the field count.
## DB Header
1. Magic 0xDB
2. u4 major
3. u4 minor version
4. u16 reserved
3. u32 record count
## Record Header
1. u8 field count
2. u8 length - not including header
3. u16 crc16-arc - not including header
022094A6
## Field
Hex
0100034a6f6e020006fa616e78a656e
```
Field 1 - First Name(s)
Length 3
Jon
Field 2 - Last Name
Length 6
Janzen
```

3
src/main.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}