From 01df0a6498c958c34797eba394265e672a4b689b Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Tue, 3 Aug 2021 02:01:24 +0800 Subject: [PATCH] Make merge_sort_slices MergeSortSlices public (#243) --- src/compute/merge_sort/mod.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compute/merge_sort/mod.rs b/src/compute/merge_sort/mod.rs index 3dad0afdcb2..e3c2d4feddd 100644 --- a/src/compute/merge_sort/mod.rs +++ b/src/compute/merge_sort/mod.rs @@ -77,7 +77,7 @@ use crate::error::Result; /// This representation is useful when building arrays in memory as it allows to memcopy slices of arrays. /// This is particularly useful in merge-sort because sorted arrays (passed to the merge-sort) are more likely /// to have contiguous blocks of sorted elements (than by random). -type MergeSlice = (usize, usize, usize); +pub type MergeSlice = (usize, usize, usize); /// Takes N arrays together through `slices` under the assumption that the slices have /// a total coverage of the arrays. @@ -234,7 +234,7 @@ fn recursive_merge_sort(slices: &[&[MergeSlice]], comparator: &Comparator) -> Ve // An iterator adapter that merge-sorts two iterators of `MergeSlice` into a single `MergeSlice` // such that the resulting `MergeSlice`s are ordered according to `comparator`. -struct MergeSortSlices<'a, L, R> +pub struct MergeSortSlices<'a, L, R> where L: Iterator, R: Iterator, @@ -426,7 +426,11 @@ where /// Given two iterators of slices representing two sets of sorted [`Array`]s, and a `comparator` bound to those [`Array`]s, /// returns a new iterator of slices denoting how to `take` slices from each of the arrays such that the resulting /// array is sorted according to `comparator` -fn merge_sort_slices<'a, L: Iterator, R: Iterator>( +pub fn merge_sort_slices< + 'a, + L: Iterator, + R: Iterator, +>( lhs: L, rhs: R, comparator: &'a Comparator, @@ -439,7 +443,7 @@ type Comparator<'a> = Box Ordering + 'a>; type IsValid<'a> = Box bool + 'a>; /// returns a comparison function between any two arrays of each pair of arrays, according to `SortOptions`. -fn build_comparator<'a>( +pub fn build_comparator<'a>( pairs: &'a [(&'a [&'a dyn Array], &SortOptions)], ) -> Result> { // prepare the comparison function of _values_ between all pairs of arrays