Skip to main content

Consolidate

Trait Consolidate 

Source
pub trait Consolidate {
    // Required methods
    fn len(&self) -> usize;
    fn clear(&mut self);
    fn consolidate_into(&mut self, target: &mut Self);
}
Expand description

A container that can sort and consolidate its contents internally.

The container knows its own layout — how to sort its elements, how to compare adjacent entries, and how to merge diffs. The caller provides a target container to receive the consolidated output, allowing reuse of allocations across calls.

After the call, target contains the sorted, consolidated data and self may be empty or in an unspecified state (implementations should document this).

Required Methods§

Source

fn len(&self) -> usize

The number of elements in the container.

Source

fn clear(&mut self)

Clear the container.

Source

fn consolidate_into(&mut self, target: &mut Self)

Sort and consolidate self into target.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<D: Ord, T: Ord, R: Semigroup> Consolidate for Vec<(D, T, R)>

Source§

fn len(&self) -> usize

Source§

fn clear(&mut self)

Source§

fn consolidate_into(&mut self, target: &mut Self)

Implementors§