Add new --sort option

This adds a new `--sort` option to choose the way in which the results
in the speed comparison and the markup exports are ordered.

closes #614
closes #601
This commit is contained in:
David Peter authored and David Peter committed 2023-06-03 21:34:36 +02:00
1 parent 2393de0c36
commit ac617c8714
12 files changed
+285 -89

No files matched your search

+7 -1
View File
@@ -3,6 +3,7 @@ use serde_json::to_vec_pretty;
use super::Exporter;
use crate::benchmark::benchmark_result::BenchmarkResult;
use crate::options::SortOrder;
use crate::util::units::Unit;
use anyhow::Result;
@@ -16,7 +17,12 @@ struct HyperfineSummary<'a> {
pub struct JsonExporter {}
impl Exporter for JsonExporter {
fn serialize(&self, results: &[BenchmarkResult], _unit: Option<Unit>) -> Result<Vec<u8>> {
fn serialize(
&self,
results: &[BenchmarkResult],
_unit: Option<Unit>,
_sort_order: SortOrder,
) -> Result<Vec<u8>> {
let mut output = to_vec_pretty(&HyperfineSummary { results });
if let Ok(ref mut content) = output {
content.push(b'\n');