1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! # Qubit Binary IO
//!
//! Synchronous and asynchronous binary stream I/O adapters for Rust.
//!
//! Synchronous APIs operate on [`qubit_io::Input`] and
//! [`qubit_io::Output`]. Runtime-neutral asynchronous extension traits operate
//! on [`qubit_io::AsyncInput`] and [`qubit_io::AsyncOutput`]. Both layers reuse
//! the same codec implementations for fixed-width values, LEB128, ZigZag, and
//! length-prefixed UTF-8 strings.
//!
//! This crate combines `qubit-io` stream helpers with
//! `qubit-codec-binary` buffer codecs to provide binary reader and writer
//! extension traits and wrapper types.
//!
//! ## Asynchronous extension traits
//!
//! Async extension methods are runtime-neutral and only require `Unpin`
//! inputs and outputs:
//!
//! ```
//! use qubit_io::{
//! AsyncInput,
//! AsyncOutput,
//! };
//! use qubit_io_binary::{
//! AsyncBinaryReadExt,
//! AsyncBinaryWriteExt,
//! };
//!
//! async fn relay<I, O>(input: &mut I, output: &mut O) -> std::io::Result<()>
//! where
//! I: AsyncInput<Item = u8> + Unpin,
//! O: AsyncOutput<Item = u8> + Unpin,
//! {
//! let value = input.read_u32_be_async().await?;
//! output.write_u32_be_async(value).await
//! }
//! ```
pub use AsyncBinaryReadExt;
pub use AsyncBinaryWriteExt;
pub use AsyncLeb128ReadExt;
pub use AsyncLeb128WriteExt;
pub use AsyncStringReadExt;
pub use AsyncStringWriteExt;
pub use AsyncZigZagReadExt;
pub use AsyncZigZagWriteExt;
pub use BinaryReadExt;
pub use BinaryWriteExt;
pub use Leb128ReadExt;
pub use Leb128WriteExt;
pub use StringReadExt;
pub use StringWriteExt;
pub use ZigZagReadExt;
pub use ZigZagWriteExt;
pub use BinaryReader;
pub use BinaryWriter;
pub use BufferedBinaryReader;
pub use BufferedBinaryWriter;
pub use BufferedLeb128Reader;
pub use BufferedLeb128Writer;
pub use BufferedZigZagReader;
pub use BufferedZigZagWriter;
pub use Leb128Reader;
pub use Leb128Writer;
pub use ZigZagReader;
pub use ZigZagWriter;