Into C
Let's embed some Rust into C. The quantiles library (https://crates.io/crates/quantiles)—discussed in Chapter 4, Sync and Send – the Foundation of Rust Concurrency—implements online summarization algorithms. These algorithms are easy to get wrong, in terms of producing incorrect results, but more often in storing more points than strictly necessary. A good deal of work has gone into quantiles to ensure the algorithms implemented there are near the theoretical minimum storage requirements, and so it makes sense to reuse this library for online summarization in C, rather than redo all that work.
Specifically, let's expose a quantiles::ckms::CKMS<f32> to C (https://docs.rs/quantiles/0.7.1/quantiles/ckms/struct.CKMS.html). We have to make ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access