qubit_io/lib.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8
9//! # Qubit IO
10//!
11//! Byte-stream buffering and small I/O trait utilities for Rust.
12//!
13//! This crate provides named, object-safe composition traits for common
14//! [`std::io`] capability combinations and small extension traits for recurring
15//! standard-library I/O patterns.
16//!
17//! It also provides byte-oriented buffering primitives in [`buffered`]:
18//! [`Buffer`], [`BufferedByteInput`], and [`BufferedByteOutput`]. These types
19//! are intentionally format-agnostic. Binary and text stream adapters live in
20//! sibling crates and build their codec-specific behavior on top of these byte
21//! windows.
22//!
23//! The concrete trait definitions and wrapper types live in dedicated modules
24//! and are re-exported from the crate root for ergonomic use.
25
26pub mod buffered;
27mod ext;
28pub mod prelude;
29mod traits;
30mod util;
31mod wrappers;
32
33pub use buffered::{
34 Buffer,
35 BufferedByteInput,
36 BufferedByteOutput,
37 DEFAULT_BUFFER_CAPACITY,
38};
39pub use ext::{
40 BufReadExt,
41 ReadExt,
42 ReadSeekExt,
43 SeekExt,
44 WriteExt,
45 WriteSeekExt,
46};
47pub use traits::{
48 BufReadSeek,
49 ReadSeek,
50 ReadWrite,
51 ReadWriteSeek,
52 WriteSeek,
53};
54pub use util::Streams;
55pub use wrappers::{
56 ChecksumReader,
57 ChecksumWriter,
58 CountingReader,
59 CountingWriter,
60 LimitReader,
61 LimitWriter,
62 PositionGuard,
63 TeeReader,
64 TeeWriter,
65};