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/*!
9
10Helpers and statistics.
11
12[`CountBitReader`] and [`CountBitWriter`] keep track of the number
13of bits read or written to a [`BitRead`](crate::traits::BitRead)
14and [`BitWrite`](crate::traits::BitWrite), respectively,
15optionally printing on standard error the operations performed on the stream.
16
17[`DbgBitReader`] and [`DbgBitWriter`] print on standard error all
18operation beformed by a [`BitRead`](crate::traits::BitRead) or
19[`BitWrite`](crate::traits::BitWrite).
20
21[`CodesStats`] keeps track of the space needed to store a stream of
22integers using different codes.
23
24It also provides [`sample_implied_distribution`], it is an infinite iterator that
25returns samples from the implied distribution of a code,
26and the helper functions and structs we use to implement it:
27- [`FindChangePoints`] to find, using exponential search, the points where a
28 non decreasing monotonic function changes value.
29- [`get_implied_distribution`] to calculate the implied distribution of a code.
30
31*/
32
33mod count;
34pub use count::*;
35
36mod dbg_codes;
37pub use dbg_codes::*;
38
39mod find_change;
40pub use find_change::*;
41
42mod implied;
43pub use implied::*;
44
45pub mod stats;
46pub use stats::{CodesStats, CodesStatsWrapper};