Skip to main content

bcp_decoder/
lib.rs

1#![warn(clippy::pedantic)]
2
3//! BCP decoder — parses binary payloads into typed blocks.
4//!
5//! Two APIs are provided:
6//!
7//! - [`BcpDecoder`] — synchronous, operates on a complete `&[u8]` slice.
8//! - [`StreamingDecoder`] — asynchronous, reads from any `AsyncRead` source
9//!   and yields blocks incrementally. Requires the `streaming` feature (enabled
10//!   by default).
11//!
12//! **Compression and streaming**: The streaming decoder provides true
13//! incremental parsing for uncompressed and per-block-compressed payloads.
14//! However, whole-payload compression (`HeaderFlags::COMPRESSED`) forces
15//! the streaming decoder to buffer the entire payload before yielding
16//! blocks — the streaming API surface is preserved but the memory and
17//! latency benefits are lost. Prefer per-block compression when streaming
18//! matters.
19
20pub mod block_reader;
21pub mod decoder;
22pub mod error;
23#[cfg(feature = "streaming")]
24pub mod streaming;
25
26mod decompression;
27
28pub use decoder::{DecodedPayload, BcpDecoder};
29pub use error::DecodeError;
30#[cfg(feature = "streaming")]
31pub use streaming::{DecoderEvent, StreamingDecoder};