Compare commits
4 Commits
386c2a5d27
...
6350f421a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 6350f421a1 | |||
| 156710ec53 | |||
| 3871a1dcb7 | |||
| c86504ea95 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,4 +10,3 @@ Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
|
||||
45
.vscode/launch.json
vendored
Normal file
45
.vscode/launch.json
vendored
Normal 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
9
Cargo.toml
Normal 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]
|
||||
45
README.md
45
README.md
@@ -1,3 +1,48 @@
|
||||
# binary_address_book
|
||||
|
||||
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
3
src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user