MCPcopy Create free account
hub / github.com/PerroEngine/Perro / compare_rows

Method compare_rows

perro_source/core/perro_csv/src/lib.rs:759–773  ·  view source on GitHub ↗
(&self, a: usize, b: usize, sort: CsvSort)

Source from the content-addressed store, hash-verified

757 (false, true) => std::cmp::Ordering::Less,
758 (true, false) => std::cmp::Ordering::Greater,
759 (true, true) => a.1.cmp(b.1),
760 }
761 } else {
762 a.1.cmp(b.1)
763 };
764 let ord = match sort.order {
765 CsvOrder::Asc => ord,
766 CsvOrder::Desc => ord.reverse(),
767 };
768 ord.then_with(|| a.0.cmp(&b.0))
769 };
770 if let Some(limit) = limit {
771 let _ = keyed.select_nth_unstable_by(limit, cmp);
772 keyed.truncate(limit);
773 }
774 keyed.sort_unstable_by(cmp);
775 rows.clear();
776 rows.extend(keyed.iter().map(|(row, _, _)| *row));

Callers 1

runMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected