This is tdigest, a Rust implementation of the t-digest data structure for accurate quantile estimation. It follows Facebook's folly TDigest implementation. The crate is published on crates.io as tdigest.
cargo build # Build with default features
cargo build --all-features # Build with serde support
cargo test --all-features # Run all tests including serde round-trip
cargo fmt --all -- --check # Check formatting
cargo check --all-features # Type-check onlysrc/lib.rs-- entire library:Centroid,TDigest, all methods, and all testsCargo.toml-- package metadata, MSRV 1.62, optionaluse_serdefeaturedocs/architecture.md-- algorithm and architecture documentationrustfmt.toml-- max_width = 120
- Single-file library (
src/lib.rs), tests are inline#[cfg(test)]at the bottom - Immutable API: data methods (
merge_sorted,merge_unsorted) take&selfand return a newTDigest Option<f64>for fallible queries (min,max,mean,estimate_quantile) -- never NaN sentinels#[must_use]on methods returning new values#[non_exhaustive]on public structsdebug_assertfor invariant checks (NaN rejection, min/max presence)- No external dependencies by default;
serdeis behind theuse_serdefeature flag - Formatting: rustfmt with max_width=120
GitHub Actions (.github/workflows/CI.yml): check, test (ubuntu/macos/windows), MSRV (1.62), code coverage (tarpaulin + codecov), rustfmt.