gf2/lib.rs
1#![doc = include_str!("../docs/gf2.md")]
2// Enable unstable Rust features when the `unstable` feature is enabled.
3// - The `BitArray` type requires simple arithmetic on const generic parameters.
4// - Function traits lets us have the extra evaluation: `p(M)` for a bit-polynomial `p` and a bit-matrix `M`.
5#![cfg_attr(feature = "unstable", feature(fn_traits))]
6#![cfg_attr(feature = "unstable", feature(unboxed_closures))]
7#![cfg_attr(feature = "unstable", feature(generic_const_exprs))]
8#![cfg_attr(feature = "unstable", allow(incomplete_features))]
9
10// Most foreign trait implementations for the concrete `BitStore` types are defined using macros to avoid code
11// duplication. Some of the macros are also used by `BitMat` so need to be seen first.
12// The macros themselves are not part of the public API.
13#[macro_use]
14mod store_traits;
15
16// `Unsigned` is a trait for the primitive unsigned integer types that can back a bit-store.
17pub mod unsigned;
18pub use unsigned::Unsigned;
19
20// `BitStore` is the core trait for `BitArray`, `BitVec`, and `BitSlice`.
21pub mod store;
22pub use store::BitStore;
23
24// `BitArray` is a _statically sized_ array of bits --- a _bit-array_.
25// We need arithmetic on const generic parameters to implement `BitArray`, so gate it behind the `unstable` feature.
26#[cfg(feature = "unstable")]
27pub mod array;
28#[cfg(feature = "unstable")]
29pub use array::BitArray;
30
31// `BitVec` is a _dynamically sized_ vector of bits --- a _bit-vector_.
32pub mod vec;
33pub use vec::BitVec;
34
35// `BitSlice` is a non-owning view of a range of bits within any bit-store --- a _bit-slice_.
36pub mod slice;
37pub use slice::BitSlice;
38
39// `Bits`, `SetBits`, `UnsetBits`, and `Words` iterators over any bit-store.
40pub mod iterators;
41pub use iterators::{
42 Bits,
43 SetBits,
44 UnsetBits,
45 Words,
46};
47
48// `BitPoly` is a polynomial over GF(2) --- a _bit-polynomial_.
49pub mod poly;
50pub use poly::BitPoly;
51
52// `BitMat` is a _dynamically sized_ matrix of bits --- a _bit-matrix_.
53pub mod mat;
54pub use mat::BitMat;
55
56// `BitGauss` is a Gaussian elimination solver for systems of linear equations over GF(2).
57pub mod gauss;
58pub use gauss::BitGauss;
59
60// `BitLU` provides the LU decomposition for bit-matrices.
61pub mod lu;
62pub use lu::BitLU;
63
64// `rng` is a helper module that needs to be visible but which exports nothing outside the crate.
65// It provides a simple shared PRNG that is used to fill bit-stores and bit-matrices with random values.
66mod rng;