Skip to main content

merge_from

Function merge_from 

Source
pub fn merge_from<D, T, R, Ch>(
    target: &mut Ch,
    others: &mut [Ch],
    positions: &mut [usize],
) -> bool
where D: Columnar, for<'a> Ref<'a, D>: Copy + Ord, T: Columnar + Default + Clone + PartialOrder, for<'a> Ref<'a, T>: Copy + Ord, R: Columnar + Default + Semigroup + for<'a> Semigroup<Ref<'a, R>>, Ch: MergeChunk<(D, T, R)>,
Expand description

Merge items from sorted inputs into target, advancing positions.

Mirrors the dispatch shape used by the merge-batcher framework:

  • 0: no-op
  • 1: bulk copy (or swap, if target is empty and *pos == 0)
  • 2: merge two sorted streams, with diff consolidation on equal (data, time) keys and gallop bulk-copy of long single-side runs.

Returns true if the merge stopped because the amortized ship-threshold check inside the inner loop fired (the caller should ship target before the next call). Returns false if the merge stopped because at least one input was exhausted at its position (the caller should refill that side; target may still be at capacity from accumulation across short calls and the caller should also check at_capacity in that case).

The 0- and 1-input dispatches always return false: 0 does no work, 1 is a bulk copy or swap that runs to completion.