json.rs
This file
Path
src/export/json.rs
33 lines · 731 bytes · Rust
Last changed by
Add new --sort optionDavid Peterbefore adoptionac617c8
History of this fileTake it
The walk stopped after 200 commits: lines older than a596c70 point at it.
Bump rust_decimal from 1.25.0 to 1.26.1dependabot[bot]before adoptiona596c70
lines 1–5why, one step back1use serde::*;2use serde_json::to_vec_pretty;34use super::Exporter;5use crate::benchmark::benchmark_result::BenchmarkResult;Add new --sort optionDavid Peterbefore adoptionac617c8
line 6why, one step back6use crate::options::SortOrder;Bump rust_decimal from 1.25.0 to 1.26.1dependabot[bot]before adoptiona596c70
lines 7–19why, one step back7use crate::util::units::Unit;89use anyhow::Result;1011#[derive(Serialize, Debug)]12struct HyperfineSummary<'a> {13 results: &'a [BenchmarkResult],14}1516#[derive(Default)]17pub struct JsonExporter {}1819impl Exporter for JsonExporter {Add new --sort optionDavid Peterbefore adoptionac617c8
lines 20–25why, one step back20 fn serialize(21 &self,22 results: &[BenchmarkResult],23 _unit: Option<Unit>,24 _sort_order: SortOrder,25 ) -> Result<Vec<u8>> {Bump rust_decimal from 1.25.0 to 1.26.1dependabot[bot]before adoptiona596c70
line 26why, one step back26 let mut output = to_vec_pretty(&HyperfineSummary { results });Fix clippy suggestionsDavid Peterbefore adoptionc7e5694
line 27why, one step back27 if let Ok(ref mut content) = output {Bump rust_decimal from 1.25.0 to 1.26.1dependabot[bot]before adoptiona596c70
lines 28–33why, one step back28 content.push(b'\n');29 }3031 Ok(output?)32 }33}