Compare commits
10 commits
1128083ed5
...
fdfaa86a17
Author | SHA1 | Date | |
---|---|---|---|
fdfaa86a17 | |||
![]() |
0f05dc2b75 | ||
![]() |
a4ea539c5c | ||
![]() |
517ae34a3b | ||
![]() |
2dfb1cc56c | ||
![]() |
e9f3e46575 | ||
![]() |
e1d18942dc | ||
![]() |
2c33dfeb59 | ||
![]() |
e0cd91f219 | ||
![]() |
31b417b5cf |
11 changed files with 191 additions and 190 deletions
210
Cargo.lock
generated
210
Cargo.lock
generated
|
@ -1,364 +1,364 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
dependencies = [
|
||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
|
||||
dependencies = [
|
||||
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc",
|
||||
"termion",
|
||||
"winapi 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
|
||||
|
||||
[[package]]
|
||||
name = "case"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88b166b48e29667f5443df64df3c61dc07dc2b1a0b0d231800e07f09a33ecc1"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim",
|
||||
"term_size",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cobs"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c44be444fc7959957b0f331d596bafcfbbe30cbdf41665d1c40c68eda24137f6"
|
||||
|
||||
[[package]]
|
||||
name = "crc16"
|
||||
version = "0.3.4"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff"
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.0.0-beta.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7a9e063dcebdb56c306f23e672bfd31df3da8ec5f6d696b35f2c29c2a9572f0"
|
||||
dependencies = [
|
||||
"csv-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"csv-core",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv-core"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae1fbabf21d9a52d04675cc5b032d7bae24ecdcd22646f7eefcd0496a122686c"
|
||||
dependencies = [
|
||||
"memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive-error"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec098440b29ea3b1ece3e641bac424c19cf996779b623c9e0f2171495425c2c8"
|
||||
dependencies = [
|
||||
"case 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"case",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c088ec0ed2282dcd054f2c124c0327f953563e6c75fdc6ff5141779596289830"
|
||||
|
||||
[[package]]
|
||||
name = "framed"
|
||||
version = "0.4.3"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cobs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crc16 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ref_slice 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ssmarshal 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder",
|
||||
"cobs",
|
||||
"crc16",
|
||||
"ref_slice",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"ssmarshal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "framed_decode"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"csv 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"derive-error 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"framed 0.4.3",
|
||||
"serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap",
|
||||
"csv",
|
||||
"derive-error",
|
||||
"framed",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "framed_test_type"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"framed 0.4.3",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"framed",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
dependencies = [
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07b8f011e3254d5a9b318fde596d409a0001c9ae4c6e7907520c2eaa4d988c99"
|
||||
|
||||
[[package]]
|
||||
name = "redox_termios"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref_slice"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "825740057197b7d43025e7faf6477eaabc03434e153233da02d1f44602f71527"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote",
|
||||
"serde_derive_internals",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive_internals"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5"
|
||||
dependencies = [
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn",
|
||||
"synom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb"
|
||||
dependencies = [
|
||||
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dtoa",
|
||||
"itoa",
|
||||
"num-traits",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ssmarshal"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
|
||||
dependencies = [
|
||||
"encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"encode_unicode",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.11.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote",
|
||||
"synom",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synom"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
dependencies = [
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term_size"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
dependencies = [
|
||||
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"redox_termios",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
dependencies = [
|
||||
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
|
||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
|
||||
"checksum case 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e88b166b48e29667f5443df64df3c61dc07dc2b1a0b0d231800e07f09a33ecc1"
|
||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||
"checksum cobs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c44be444fc7959957b0f331d596bafcfbbe30cbdf41665d1c40c68eda24137f6"
|
||||
"checksum crc16 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "11a65c4797332f3e3a5945e0377875afc79b1bdc87082a4f98ac1ef15b47e2dd"
|
||||
"checksum csv 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e7a9e063dcebdb56c306f23e672bfd31df3da8ec5f6d696b35f2c29c2a9572f0"
|
||||
"checksum csv-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1fbabf21d9a52d04675cc5b032d7bae24ecdcd22646f7eefcd0496a122686c"
|
||||
"checksum derive-error 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ec098440b29ea3b1ece3e641bac424c19cf996779b623c9e0f2171495425c2c8"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c088ec0ed2282dcd054f2c124c0327f953563e6c75fdc6ff5141779596289830"
|
||||
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0"
|
||||
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
||||
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum redox_syscall 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "07b8f011e3254d5a9b318fde596d409a0001c9ae4c6e7907520c2eaa4d988c99"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum ref_slice 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "825740057197b7d43025e7faf6477eaabc03434e153233da02d1f44602f71527"
|
||||
"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526"
|
||||
"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0"
|
||||
"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5"
|
||||
"checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb"
|
||||
"checksum ssmarshal 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
|
||||
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
|
|
@ -16,6 +16,8 @@ rustup toolchain update ${TC};
|
|||
|
||||
cd ${REPO_DIR}/framed;
|
||||
|
||||
export RUSTFLAGS="--deny warnings";
|
||||
|
||||
# use_std build
|
||||
cargo +${TC} test -p framed --verbose --lib;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
extern crate csv;
|
||||
|
|
|
@ -16,7 +16,7 @@ branch = "master"
|
|||
[dependencies]
|
||||
byteorder = { version = "^1.2.1", default-features = false }
|
||||
cobs = { version = "^0.1.4", default-features = false }
|
||||
crc16 = "^0.3.4"
|
||||
crc16 = "0.4.0"
|
||||
ref_slice = "^1.1.1"
|
||||
serde = { version = "^1.0", default-features = false }
|
||||
ssmarshal = { version = "^1.0", default-features = false }
|
||||
|
@ -31,7 +31,7 @@ default = ["use_std"]
|
|||
trace = []
|
||||
|
||||
# Use standard library. Enabled by default, disable for no_std.
|
||||
use_std = ["serde/std", "ssmarshal/std"]
|
||||
use_std = ["serde/std", "ssmarshal/std", "cobs/use_std"]
|
||||
|
||||
# Enables unstable features that only work on nightly rust.
|
||||
# Required for practical no_std use.
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
//! assert_eq!(payload, *decoded);
|
||||
//! ```
|
||||
//!
|
||||
//! ## Example usage from a no_std crate
|
||||
//! ## Example usage from a `no_std` crate
|
||||
//!
|
||||
//! The `encode_to_slice` and `decode_from_slice` functions offer an
|
||||
//! API for `no_std` crates that do not have a heap allocator
|
||||
|
@ -125,7 +125,7 @@ impl Config {
|
|||
pub fn to_receiver<R: Read>(&mut self, r: R) -> Receiver<R> {
|
||||
Receiver::<R> {
|
||||
codec: self.to_codec(),
|
||||
r: r,
|
||||
r,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ impl Config {
|
|||
pub fn to_sender<W: Write>(&mut self, w: W) -> Sender<W> {
|
||||
Sender::<W> {
|
||||
codec: self.to_codec(),
|
||||
w: w,
|
||||
w,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ impl Config {
|
|||
}
|
||||
|
||||
/// Get the current checksum configuration.
|
||||
pub fn checksum(&self) -> &Checksum {
|
||||
#[must_use] pub fn checksum(&self) -> &Checksum {
|
||||
&self.checksum
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,7 @@ impl Codec {
|
|||
}
|
||||
|
||||
fn min_frame_len(&self) -> usize {
|
||||
0 // payload length
|
||||
+ self.checksum().len()
|
||||
self.checksum().len()
|
||||
+ 1 // sentinel length
|
||||
}
|
||||
|
||||
|
@ -194,13 +193,17 @@ impl Codec {
|
|||
let cobs_len = {
|
||||
let mut cobs_enc = cobs::CobsEncoder::new(dest);
|
||||
cobs_enc.push(p)
|
||||
.map_err(|_| Error::CobsEncodeFailed)?;
|
||||
.map_err(|()| Error::CobsEncodeFailed)?;
|
||||
if checksum_value.len() > 0 {
|
||||
cobs_enc.push(&*checksum_value)
|
||||
.map_err(|_| Error::CobsEncodeFailed)?;
|
||||
cobs_enc.push(&checksum_value)
|
||||
.map_err(|()| Error::CobsEncodeFailed)?;
|
||||
}
|
||||
let cobs_len = cobs_enc.finalize()
|
||||
.map_err(|_| Error::CobsEncodeFailed)?;
|
||||
.map_err(|()| Error::CobsEncodeFailed)?;
|
||||
// make sure sentinel is not in output buffer
|
||||
for x in &mut dest[..cobs_len] {
|
||||
*x ^= FRAME_END_SYMBOL;
|
||||
}
|
||||
cobs_len
|
||||
};
|
||||
dest[cobs_len] = FRAME_END_SYMBOL;
|
||||
|
@ -217,7 +220,7 @@ impl Codec {
|
|||
#[cfg(feature = "use_std")]
|
||||
pub fn encode_to_box(&mut self, p: &Payload) -> Result<BoxEncoded> {
|
||||
let mut buf = vec![0; max_encoded_len(p.len())];
|
||||
let len = self.encode_to_slice(p, &mut *buf)?;
|
||||
let len = self.encode_to_slice(p, &mut buf)?;
|
||||
buf.truncate(len);
|
||||
Ok(BoxEncoded::from(buf))
|
||||
}
|
||||
|
@ -233,7 +236,7 @@ impl Codec {
|
|||
pub fn encode_to_writer<W: Write>(&mut self, p: &Payload, w: &mut W)
|
||||
-> Result<usize> {
|
||||
let b = self.encode_to_box(p)?;
|
||||
w.write_all(&*b.0)?;
|
||||
w.write_all(&b.0)?;
|
||||
Ok(b.len())
|
||||
}
|
||||
|
||||
|
@ -245,7 +248,7 @@ impl Codec {
|
|||
/// whole buffer including `FRAME_END_SYMBOL` to this function for
|
||||
/// decoding.
|
||||
///
|
||||
/// If there is more than 1 FRAME_END_SYMBOL within `e`, the result
|
||||
/// If there is more than 1 `FRAME_END_SYMBOL` within `e`, the result
|
||||
/// is undefined. Make sure you only pass 1 frame at a time.
|
||||
///
|
||||
/// Returns the length of the payload it has decoded.
|
||||
|
@ -268,7 +271,7 @@ impl Codec {
|
|||
println!("framed::decode: Encoded = {:?}", e);
|
||||
}
|
||||
|
||||
if e.len() == 0 {
|
||||
if e.is_empty() {
|
||||
return Err(Error::EofBeforeFrame);
|
||||
}
|
||||
|
||||
|
@ -285,11 +288,11 @@ impl Codec {
|
|||
|
||||
let cobs_payload = &e[0..e.len() - 1];
|
||||
let cobs_decoded_len =
|
||||
if cobs_payload.len() == 0 {
|
||||
if cobs_payload.is_empty() {
|
||||
0
|
||||
} else {
|
||||
cobs::decode(cobs_payload, dest)
|
||||
.map_err(|_| Error::CobsDecodeFailed)?
|
||||
cobs::decode_with_sentinel(cobs_payload, dest, FRAME_END_SYMBOL)
|
||||
.map_err(|()| Error::CobsDecodeFailed)?
|
||||
};
|
||||
let cobs_decoded = &dest[0..cobs_decoded_len];
|
||||
if cobs_decoded_len < self.checksum().len() {
|
||||
|
@ -324,7 +327,7 @@ impl Codec {
|
|||
/// Decode the supplied encoded frame, returning the payload on the heap.
|
||||
#[cfg(feature = "use_std")]
|
||||
pub fn decode_to_box(&mut self, e: &Encoded) -> Result<BoxPayload> {
|
||||
if e.len() == 0 {
|
||||
if e.is_empty() {
|
||||
return Err(Error::EofBeforeFrame);
|
||||
}
|
||||
let mut buf = vec![0; max_decoded_len(e.len())];
|
||||
|
@ -350,9 +353,9 @@ impl Codec {
|
|||
// In the 2 EOF cases defer to decode_to_box to return the
|
||||
// correct error (EofBeforeFrame or EofDuringFrame).
|
||||
Err(ref e) if e.kind() == io::ErrorKind::UnexpectedEof =>
|
||||
return self.decode_to_box(&*next_frame),
|
||||
return self.decode_to_box(&next_frame),
|
||||
Ok(0) =>
|
||||
return self.decode_to_box(&*next_frame),
|
||||
return self.decode_to_box(&next_frame),
|
||||
|
||||
Err(e) => return Err(Error::from(e)),
|
||||
Ok(1) => (),
|
||||
|
@ -369,7 +372,7 @@ impl Codec {
|
|||
}
|
||||
assert_eq!(next_frame[next_frame.len()-1], FRAME_END_SYMBOL);
|
||||
|
||||
self.decode_to_box(&*next_frame)
|
||||
self.decode_to_box(&next_frame)
|
||||
}
|
||||
} // End of impl Codec.
|
||||
|
||||
|
@ -531,9 +534,8 @@ mod tests {
|
|||
fn assert_payload_eq(encoded: &Encoded, payload: &Payload) {
|
||||
#[cfg(feature = "use_std")] {
|
||||
println!("assert_payload_eq \n\
|
||||
- encoded = {:?}\n\
|
||||
- payload = {:?}",
|
||||
encoded, payload);
|
||||
- encoded = {encoded:?}\n\
|
||||
- payload = {payload:?}");
|
||||
}
|
||||
let mut decoded_buf = [0; 100];
|
||||
let len = codec().decode_to_slice(encoded, &mut decoded_buf).unwrap();
|
||||
|
@ -552,7 +554,7 @@ mod tests {
|
|||
#[cfg(feature = "use_std")]
|
||||
fn encode_to_slice_ok_dynamic_dest() {
|
||||
let mut encoded_buf = vec![0u8; max_encoded_len(PAYLOAD.len())];
|
||||
let len = codec().encode_to_slice(&PAYLOAD, &mut *encoded_buf).unwrap();
|
||||
let len = codec().encode_to_slice(&PAYLOAD, &mut encoded_buf).unwrap();
|
||||
let encoded = &encoded_buf[0..len];
|
||||
|
||||
assert_payload_eq(encoded, &PAYLOAD);
|
||||
|
@ -574,7 +576,7 @@ mod tests {
|
|||
fn encode_to_writer_ok() {
|
||||
let mut encoded = vec![];
|
||||
codec().encode_to_writer(&PAYLOAD, &mut encoded).unwrap();
|
||||
assert_payload_eq(&*encoded, &PAYLOAD);
|
||||
assert_payload_eq(&encoded, &PAYLOAD);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -583,7 +585,7 @@ mod tests {
|
|||
let mut buf = [0; ENCODED_LEN];
|
||||
let encoded = encoded_payload(&mut buf);
|
||||
let mut decoded_buf = [0u8; PAYLOAD_LEN - 1];
|
||||
let _ = codec().decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let _ = codec().decode_to_slice(encoded, &mut decoded_buf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -591,7 +593,7 @@ mod tests {
|
|||
fn decode_to_slice_ok_dynamic_dest() {
|
||||
let encoded = codec().encode_to_box(&PAYLOAD).unwrap();
|
||||
let mut decoded_buf = vec![0u8; max_decoded_len(encoded.len())];
|
||||
let len = codec().decode_to_slice(&*encoded, &mut decoded_buf).unwrap();
|
||||
let len = codec().decode_to_slice(&encoded, &mut decoded_buf).unwrap();
|
||||
let decoded = &decoded_buf[0..len];
|
||||
|
||||
assert_eq!(&PAYLOAD, decoded);
|
||||
|
@ -602,7 +604,7 @@ mod tests {
|
|||
fn decode_to_slice_no_end_symbol() {
|
||||
let encoded = vec![FRAME_END_SYMBOL + 1; max_encoded_len(0)];
|
||||
let mut decoded_buf = [];
|
||||
let res = codec().decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let res = codec().decode_to_slice(&encoded, &mut decoded_buf);
|
||||
|
||||
match res {
|
||||
Err(Error::EofDuringFrame) => (),
|
||||
|
@ -616,7 +618,7 @@ mod tests {
|
|||
let mut c = codec();
|
||||
let encoded = vec![FRAME_END_SYMBOL; c.min_frame_len() - 1];
|
||||
let mut decoded_buf = [];
|
||||
let res = c.decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let res = c.decode_to_slice(&encoded, &mut decoded_buf);
|
||||
|
||||
match res {
|
||||
Err(Error::EofDuringFrame) => (),
|
||||
|
@ -629,7 +631,7 @@ mod tests {
|
|||
fn decode_to_slice_encoded_empty() {
|
||||
let encoded = vec![];
|
||||
let mut decoded_buf = [];
|
||||
let res = codec().decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let res = codec().decode_to_slice(&encoded, &mut decoded_buf);
|
||||
|
||||
match res {
|
||||
Err(Error::EofBeforeFrame) => (),
|
||||
|
@ -654,7 +656,7 @@ mod tests {
|
|||
}
|
||||
|
||||
let mut decoded_buf = vec![0u8; max_decoded_len(encoded.len())];
|
||||
let res = codec().decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let res = codec().decode_to_slice(&encoded, &mut decoded_buf);
|
||||
|
||||
match res {
|
||||
Err(Error::ChecksumError) => (),
|
||||
|
@ -669,7 +671,7 @@ mod tests {
|
|||
let encoded = &encoded[1..encoded.len()];
|
||||
|
||||
let mut decoded_buf = vec![0u8; max_decoded_len(encoded.len())];
|
||||
let res = codec().decode_to_slice(&*encoded, &mut decoded_buf);
|
||||
let res = codec().decode_to_slice(encoded, &mut decoded_buf);
|
||||
|
||||
match res {
|
||||
Err(Error::ChecksumError) => (),
|
||||
|
@ -681,11 +683,20 @@ mod tests {
|
|||
#[cfg(feature = "use_std")]
|
||||
fn decode_to_box_ok() {
|
||||
let encoded = codec().encode_to_box(&PAYLOAD).unwrap();
|
||||
let decoded = codec().decode_to_box(&*encoded).unwrap();
|
||||
let decoded = codec().decode_to_box(&encoded).unwrap();
|
||||
|
||||
assert_eq!(&PAYLOAD, &*decoded);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "use_std")]
|
||||
fn decode_to_box_extra_byte_in_front() {
|
||||
let encoded = codec().encode_to_box(&PAYLOAD).unwrap();
|
||||
let encoded_with_extra_in_front = [&[3], &*encoded].concat();
|
||||
let decoded = codec().decode_to_box(&encoded_with_extra_in_front);
|
||||
assert!(decoded.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "use_std")]
|
||||
fn decode_from_reader_ok() {
|
||||
|
@ -701,7 +712,7 @@ mod tests {
|
|||
fn roundtrip_default_config() {
|
||||
roundtrip_case(&mut Config::default()
|
||||
.to_codec(),
|
||||
&PAYLOAD)
|
||||
&PAYLOAD);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -710,7 +721,7 @@ mod tests {
|
|||
roundtrip_case(&mut Config::default()
|
||||
.set_checksum(Checksum::None)
|
||||
.to_codec(),
|
||||
&PAYLOAD)
|
||||
&PAYLOAD);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -718,16 +729,16 @@ mod tests {
|
|||
fn roundtrip_empty_payload() {
|
||||
roundtrip_case(&mut Config::default()
|
||||
.to_codec(),
|
||||
&[])
|
||||
&[]);
|
||||
}
|
||||
|
||||
#[cfg(feature = "use_std")]
|
||||
fn roundtrip_case(c: &mut Codec, payload: &Payload) {
|
||||
let encoded = c.encode_to_box(payload);
|
||||
println!("encoded: {:?}", encoded);
|
||||
println!("encoded: {encoded:?}");
|
||||
let encoded = encoded.unwrap();
|
||||
let decoded = c.decode_to_box(&*encoded);
|
||||
println!("decoded: {:?}", decoded);
|
||||
let decoded = c.decode_to_box(&encoded);
|
||||
println!("decoded: {decoded:?}");
|
||||
let decoded = decoded.unwrap();
|
||||
assert_eq!(&*decoded, payload);
|
||||
}
|
||||
|
@ -778,8 +789,8 @@ mod rw_tests {
|
|||
|
||||
let r1 = rx.recv().unwrap();
|
||||
let r2 = rx.recv().unwrap();
|
||||
println!("r1: {:?}\n\
|
||||
r2: {:?}", r1, r2);
|
||||
println!("r1: {r1:?}\n\
|
||||
r2: {r2:?}");
|
||||
|
||||
assert_eq!(*r1, s1);
|
||||
assert_eq!(*r2, s2);
|
||||
|
@ -790,7 +801,7 @@ mod rw_tests {
|
|||
let (mut _tx, mut rx) = pair();
|
||||
match rx.recv() {
|
||||
Err(Error::EofBeforeFrame) => (),
|
||||
e @ _ => panic!("Bad value: {:?}", e)
|
||||
e => panic!("Bad value: {:?}", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,7 +813,7 @@ mod rw_tests {
|
|||
tx_raw.write(&[0x01]).unwrap();
|
||||
match rx.recv() {
|
||||
Err(Error::EofDuringFrame) => (),
|
||||
e @ _ => panic!("Bad value: {:?}", e)
|
||||
e => panic!("Bad value: {:?}", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use crc16;
|
|||
|
||||
/// A checksum algorithm configuration to use when encoding data.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Default)]
|
||||
pub enum Checksum {
|
||||
/// Use no checksum.
|
||||
None,
|
||||
|
@ -15,14 +16,10 @@ pub enum Checksum {
|
|||
/// This is the default checksum.
|
||||
///
|
||||
/// [impl]: https://docs.rs/crc16/0.3.4/crc16/enum.CDMA2000.html
|
||||
#[default]
|
||||
Crc16Cdma2000,
|
||||
}
|
||||
|
||||
impl Default for Checksum {
|
||||
fn default() -> Checksum {
|
||||
Checksum::Crc16Cdma2000
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const MAX_CHECKSUM_LEN: usize = 2;
|
||||
|
||||
|
@ -67,12 +64,12 @@ impl Deref for ChecksumValue {
|
|||
|
||||
impl PartialEq for ChecksumValue {
|
||||
fn eq(&self, other: &ChecksumValue) -> bool {
|
||||
self.deref() == other.deref()
|
||||
**self == **other
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for ChecksumValue {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
|
||||
write!(f, "{:?}", self.deref())
|
||||
write!(f, "{:?}", &**self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ pub enum Error {
|
|||
/// End of data before a frame started; we received none of a frame.
|
||||
EofBeforeFrame,
|
||||
|
||||
/// Forwarded io::Error.
|
||||
/// Forwarded `io::Error`.
|
||||
#[cfg(feature = "use_std")]
|
||||
Io(io::Error),
|
||||
|
||||
/// Forwarded ssmarshal::Error.
|
||||
/// Forwarded `ssmarshal::Error`.
|
||||
Ssmarshal(ssmarshal::Error),
|
||||
}
|
||||
|
||||
|
@ -44,14 +44,11 @@ impl Error {
|
|||
/// Returns true if the error represents a corrupted frame. Data
|
||||
/// may have been lost but the decoder should decode the next
|
||||
/// frame correctly.
|
||||
pub fn is_corrupt_frame(&self) -> bool {
|
||||
match *self {
|
||||
#[must_use] pub fn is_corrupt_frame(&self) -> bool {
|
||||
matches!(*self,
|
||||
Error::ChecksumError |
|
||||
Error::CobsDecodeFailed |
|
||||
Error::EofDuringFrame
|
||||
=> true,
|
||||
_ => false,
|
||||
}
|
||||
Error::EofDuringFrame)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
//!
|
||||
//! ## Cargo feature flags
|
||||
//!
|
||||
//! `use_std`: Use standard library. Enabled by default, disable for no_std.
|
||||
//! `use_std`: Use standard library. Enabled by default, disable for `no_std`.
|
||||
//!
|
||||
//! `use_nightly`: Enables unstable features that only work on nightly rust.
|
||||
//! Required for practical no_std use.
|
||||
//! Required for practical `no_std` use.
|
||||
//!
|
||||
//! `trace`: Enable to print all data to stdout for testing.
|
||||
//!
|
||||
|
@ -82,8 +82,8 @@
|
|||
//! and `decode_*` variants that require this are only available with
|
||||
//! the `use_std` Cargo feature.
|
||||
|
||||
#![deny(warnings)]
|
||||
#![deny(missing_docs)]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
#![cfg_attr(not(feature = "use_std"), no_std)]
|
||||
|
||||
#![cfg_attr(feature = "use_nightly", feature(const_fn))]
|
||||
|
@ -247,7 +247,7 @@ impl Deref for BoxPayload {
|
|||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &[u8] {
|
||||
&*self.0
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl Deref for BoxEncoded {
|
|||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &[u8] {
|
||||
&*self.0
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ impl<T: DeserializeOwned + Serialize> Clone for Config<T> {
|
|||
fn clone(&self) -> Config<T> {
|
||||
Config::<T> {
|
||||
bytes_config: self.bytes_config.clone(),
|
||||
_phantom: PhantomData::<T>::default(),
|
||||
_phantom: PhantomData::<T>,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ impl<T: DeserializeOwned + Serialize> Config<T> {
|
|||
pub(crate) fn new(bytes_config: &bytes::Config) -> Config<T> {
|
||||
Config::<T> {
|
||||
bytes_config: bytes_config.clone(),
|
||||
_phantom: PhantomData::<T>::default(),
|
||||
_phantom: PhantomData::<T>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ impl<T: DeserializeOwned + Serialize> Config<T> {
|
|||
pub fn to_codec(&mut self) -> Codec<T> {
|
||||
Codec::<T> {
|
||||
bytes_codec: self.bytes_config.to_codec(),
|
||||
_phantom: PhantomData::<T>::default(),
|
||||
_phantom: PhantomData::<T>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ impl<T: DeserializeOwned + Serialize> Config<T> {
|
|||
pub fn to_receiver<R: Read>(&mut self, r: R) -> Receiver<R, T> {
|
||||
Receiver::<R, T> {
|
||||
codec: self.to_codec(),
|
||||
r: r,
|
||||
r,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ impl<T: DeserializeOwned + Serialize> Config<T> {
|
|||
pub fn to_sender<W: Write>(&mut self, w: W) -> Sender<W, T> {
|
||||
Sender::<W, T> {
|
||||
codec: self.to_codec(),
|
||||
w: w,
|
||||
w,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ impl<T: DeserializeOwned + Serialize> Codec<T> {
|
|||
///
|
||||
/// ## Examples
|
||||
///
|
||||
/// See the [no_std usage example](index.html#example-usage-from-a-no_std-crate)
|
||||
/// See the [`no_std` usage example](index.html#example-usage-from-a-no_std-crate)
|
||||
/// in the `typed` module documentation.
|
||||
pub fn encode_to_slice(
|
||||
&mut self,
|
||||
|
@ -217,7 +217,7 @@ impl<T: DeserializeOwned + Serialize> Codec<T> {
|
|||
///
|
||||
/// ## Examples
|
||||
///
|
||||
/// See the [no_std usage example](index.html#example-usage-from-a-no_std-crate)
|
||||
/// See the [`no_std` usage example](index.html#example-usage-from-a-no_std-crate)
|
||||
/// in the `typed` module documentation.
|
||||
pub fn decode_from_slice(
|
||||
&mut self,
|
||||
|
@ -306,7 +306,7 @@ impl<W: Write, T: DeserializeOwned + Serialize> Sender<W, T> {
|
|||
|
||||
let ser_len = ssmarshal::serialize(&mut ser_buf, v)?;
|
||||
let ser = &ser_buf[0..ser_len];
|
||||
self.codec.bytes_codec.encode_to_writer(&ser, &mut self.w)
|
||||
self.codec.bytes_codec.encode_to_writer(ser, &mut self.w)
|
||||
}
|
||||
|
||||
/// Encode the supplied payload as a frame, write it to the
|
||||
|
@ -349,7 +349,7 @@ impl<R: Read, T: DeserializeOwned + Serialize> Receiver<R, T> {
|
|||
pub fn recv(&mut self) -> Result<T> {
|
||||
let payload =
|
||||
self.codec.bytes_codec.decode_from_reader::<R>(&mut self.r)?;
|
||||
let (v, _len) = ssmarshal::deserialize(&*payload)?;
|
||||
let (v, _len) = ssmarshal::deserialize(&payload)?;
|
||||
Ok(v)
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ mod tests {
|
|||
a: [1, 2, 3],
|
||||
};
|
||||
#[cfg(feature = "use_std")] {
|
||||
println!("Test value: {:#?}", v);
|
||||
println!("Test value: {v:#?}");
|
||||
}
|
||||
v
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ mod tests {
|
|||
let v = test_val();
|
||||
tx.send(&v).unwrap();
|
||||
let r = rx.recv().unwrap();
|
||||
println!("r: {:#?}", r);
|
||||
println!("r: {r:#?}");
|
||||
assert_eq!(v, r);
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ mod tests {
|
|||
let (mut _tx, mut rx) = pair();
|
||||
match rx.recv() {
|
||||
Err(Error::EofBeforeFrame) => (),
|
||||
e @ _ => panic!("Bad value: {:?}", e)
|
||||
e => panic!("Bad value: {:?}", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
extern crate framed;
|
||||
extern crate framed_test_type as lib;
|
||||
|
||||
|
|
Loading…
Reference in a new issue