dsi_bitstream/utils/mod.rs
1/*
2 * SPDX-FileCopyrightText: 2023 Sebastiano Vigna
3 * SPDX-FileCopyrightText: 2025 Tommaso Fontana
4 *
5 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
6 */
7
8//! Helpers and statistics.
9//!
10//! [`CountBitReader`] and [`CountBitWriter`] keep track of the number
11//! of bits read or written to a [`BitRead`](crate::traits::BitRead)
12//! and [`BitWrite`](crate::traits::BitWrite), respectively,
13//! optionally printing on standard error the operations performed on the stream.
14//!
15//! [`DbgBitReader`] and [`DbgBitWriter`] print on standard error all
16//! operations performed by a [`BitRead`](crate::traits::BitRead) or
17//! [`BitWrite`](crate::traits::BitWrite).
18//!
19//! [`CodesStats`] keeps track of the space needed to store a stream of
20//! integers using different codes.
21//!
22//! With the `implied` feature, it also provides
23//! `sample_implied_distribution`, an infinite iterator that returns samples
24//! from the implied distribution of a code, and the helper function
25//! `get_implied_distribution`.
26//!
27//! [`FindChangePoints`] finds, using exponential search, the points where a
28//! non-decreasing monotonic function changes value.
29
30mod count;
31pub use count::*;
32
33mod dbg_codes;
34pub use dbg_codes::*;
35
36mod find_change;
37pub use find_change::*;
38
39#[cfg(feature = "implied")]
40mod implied;
41#[cfg(feature = "implied")]
42pub use implied::*;
43
44pub mod stats;
45pub use stats::CodesStats;
46#[cfg(feature = "std")]
47pub use stats::CodesStatsWrapper;