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