Skip to main content

scientific_method/
conclusion.rs

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