hdlc
HDLC Framing Description
Only frames the data. Rust implementation of a High-level Data Link Control (HDLC) library with support of the IEEE standard.
Usage
Add hdlc
to Cargo.toml
[]
= "^0.2.5"
or
[]
= "https://github.com/CLomanno/hdlc"
Add this to crate root
extern crate hdlc;
Encode packet
extern crate hdlc;
use ;
// Set up your vector of bytes and generate your Special Characters
let msg: = vec!;
let cmp: = vec!;
// Encode your message
let result = encode;
assert!;
assert_eq!;
Custom Special Characters
extern crate hdlc;
use ;
// Set up your vector of bytes and generate your Special Characters
let msg: = vec!;
let cmp: = vec!;
let chars = new;
// Encode your message
let result = encode;
assert!;
assert_eq!
Decode packet
extern crate hdlc;
use ;
// Set up your vector of bytes and generate your Special Characters
let msg: = vec!;
let cmp: = vec!;
// Decode your message
let result = decode;
assert!;
assert_eq!;
Decode slice packet
extern crate hdlc;
use ;
// Set up your mutable slice of bytes and generate your Special Characters
let chars = default;
let mut msg = ;
let cmp = ;
// Decode your slice
let result = decode_slice;
assert!;
assert_eq!;
Benchmark
Bencher is currently not available in Rust stable releases.
cargo bench
with 2.4 GHz Intel Xeon E5 results ~430MB/s throughput.
cargo bench
Running target/release/deps/bench-bb5601191c448c8f
bench_encode_megabyte time:
bench_decode_megabyte time:
bench_encode_special_chars_megabyte
time:
bench_decode_special_chars_2_megabytes
time:
test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.