first commit
Some checks failed
Rust / Clippy (push) Has been cancelled
Rust / Test (nightly) (push) Has been cancelled
Rust / Test (stable) (push) Has been cancelled

This commit is contained in:
2026-01-04 16:50:19 +08:00
commit 6675986579
60 changed files with 11043 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
//! High-level Data Link Control (HDLC) support library.
pub mod codec;
pub mod consts;
pub mod crc;
pub mod decoder;
pub mod encoder;
pub mod varint;
pub use codec::Codec;
use bytes::BytesMut;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Frame {
pub address: u32,
pub control: u8,
pub data: Box<[u8]>,
}
impl Frame {
pub fn decode(buf: &mut BytesMut) -> Result<Option<Self>, decoder::Error> {
decoder::Decoder::new().process(buf)
}
pub fn encode(&self, buf: &mut BytesMut) {
encoder::encode(buf, self)
}
pub fn encode_bytes(&self) -> BytesMut {
encoder::encode_bytes(self)
}
}