Skip to main content

scientific_method/
conclusion.rs

1// Copyright © 2026 James Hunt. All rights reserved.
2
3/// The terminal scientific interpretation of an experiment.
4///
5/// This is intentionally distinct from any later implementation decision such as
6/// accepting, promoting, or retaining a candidate.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
10pub enum Outcome {
11    Supported,
12    NotSupported,
13    Inconclusive,
14}
15
16/// A scientific conclusion and the criterion evaluations supporting it.
17#[derive(Debug, Clone, PartialEq, Eq)]
18#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
19pub struct Conclusion {
20    pub outcome: Outcome,
21    pub summary: Option<String>,
22}
23
24impl Conclusion {
25    pub fn new(outcome: Outcome) -> Self {
26        Self {
27            outcome,
28            summary: None,
29        }
30    }
31
32    pub fn with_summary(mut self, summary: impl Into<String>) -> Self {
33        self.summary = Some(summary.into());
34        self
35    }
36}