From 83c32c6b9c5f5a1afaa6b0c1009c5e0ef9108c9b Mon Sep 17 00:00:00 2001 From: Christopher Regali Date: Tue, 25 Jul 2023 12:21:04 +0200 Subject: [PATCH] Add documentation of newly exposed structs --- src/csv/mod.rs | 20 ++++++++++++++++++++ src/properties.rs | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/csv/mod.rs b/src/csv/mod.rs index 55ac8c0..2fa613e 100644 --- a/src/csv/mod.rs +++ b/src/csv/mod.rs @@ -59,32 +59,52 @@ pub enum Error { UnequalRowCount(usize, usize), } +/// A position inside a table #[derive(Clone, Copy, Debug, Serialize)] pub struct Position { + /// row number, starting with zero pub row: usize, + /// column number, starting with zero pub col: usize, } #[derive(Debug, Serialize, Clone)] +/// Difference of a table entry pub enum DiffType { + /// Both entries were strings, but had different contents UnequalStrings { + /// nominal string nominal: String, + /// actual string actual: String, + /// position position: Position, }, + /// Both entries were [`Quantity`]s but exceeded tolerances OutOfTolerance { + /// nominal nominal: Quantity, + /// actual actual: Quantity, + /// compare mode that was exceeded mode: Mode, + /// position in table position: Position, }, + /// both fields had different value types DifferentValueTypes { + /// nominal nominal: Value, + /// actual actual: Value, + /// position position: Position, }, + /// Both fields were headers but with different contents UnequalHeader { + /// nominal nominal: String, + /// actual actual: String, }, } diff --git a/src/properties.rs b/src/properties.rs index 1ca0e57..870b22f 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -103,13 +103,14 @@ fn file_modification_time_out_of_tolerance( result.is_error = true; } } else { - let msg = format!("Could not calculate duration between modification timestamps"); + let msg = + "Could not calculate duration between modification timestamps".to_string(); error!("{}", &msg); result.push_detail(DiffDetail::Error(msg)); result.is_error = true; } } else { - let msg = format!("Could not read file modification timestamps"); + let msg = "Could not read file modification timestamps".to_string(); error!("{}", &msg); result.push_detail(DiffDetail::Error(msg)); result.is_error = true;