Skip to main content

TupleSummary

Trait TupleSummary 

Source
pub trait TupleSummary:
    Clone
    + Send
    + 'static {
    type Update: ?Sized;

    // Required methods
    fn create(update: &Self::Update) -> Self;
    fn union_combine(&mut self, other: &Self);
    fn intersection_combine(&mut self, other: &Self);
}
Expand description

A user-defined per-entry summary for TupleSketch.

Implement this on your own type to get a Tuple sketch that carries it.

§Panics and the FFI boundary

union_combine, intersection_combine, and Clone::clone are invoked by C++. A panic cannot unwind across that boundary, and the underlying C++ combine has no way to report failure and roll back an insert, so a panic in any of those three aborts the process after printing a diagnostic. Make them total.

create is different: it runs entirely in Rust before any C++ call, so a panic there is an ordinary Rust panic that propagates to your caller.

Required Associated Types§

Source

type Update: ?Sized

The value passed to the sketch’s update_* methods.

May be unsized — type Update = str and type Update = [f64] both work, so callers need not allocate to update.

Required Methods§

Source

fn create(update: &Self::Update) -> Self

Builds a summary from a single update value.

Source

fn union_combine(&mut self, other: &Self)

Merges other into self with union semantics. Used both when a key is updated more than once and when two sketches are unioned.

Source

fn intersection_combine(&mut self, other: &Self)

Merges other into self with intersection semantics.

There is deliberately no default: upstream notes that no intersection policy is sensible in general, and silently reusing union semantics would be a correctness trap. If union semantics are what you want, call self.union_combine(other) here explicitly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§