Skip to content
Myr

Mark reference commands in JSON exports

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parent 9511814 · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:src/export/json.rs+6 added-2 removed
26 unmodified lines
27#[derive(Serialize)]28struct JsonBenchmarkResult<'a> {29 #[serde(flatten)]30 result: &'a BenchmarkResult,31 #[serde(skip_serializing_if = "std::ops::Not::not")]32 is_reference: bool,33 summary: BenchmarkSummary,34}3536#[derive(Serialize)]
83 unmodified lines
120 &self,121 results: &[BenchmarkResult],122 _time_unit: Option<TimeUnit>,123 _sort_order: SortOrder,122 _reference_index: Option<usize>,124 reference_index: Option<usize>,125 ) -> Result<Vec<u8>> {126 let mut output = to_vec_pretty(&HyperfineSummary {127 schema_version: JSON_SCHEMA_VERSION,128 metadata: &self.metadata,129 results: results130 .iter()131 .enumerate()129 .map(|result| JsonBenchmarkResult {132 .map(|(index, result)| JsonBenchmarkResult {133 result,134 is_reference: reference_index == Some(index),135 summary: BenchmarkSummary::from_measurements(&result.measurements),136 })137 .collect(),138 });
213 unmodified lines