Skip to main content

made_core/value_objects/ceremony/
carried_evidence.rs

1use serde::{Deserialize, Serialize};
2
3use super::{SourceRecordRef, StepId, StepOutput};
4
5/// One completed step of a predecessor, carried into a successor step.
6///
7/// The output travels because a successor that could not read what was
8/// decided would be starting over; the source travels because a step
9/// the successor never ran must never read as though it had. Both
10/// halves are the point: evidence without provenance is a copy, and
11/// provenance without the output is a footnote.
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13pub struct CarriedEvidence {
14    successor_step_id: StepId,
15    source: SourceRecordRef,
16    output: StepOutput,
17}
18
19impl CarriedEvidence {
20    #[must_use]
21    pub const fn new(
22        successor_step_id: StepId,
23        source: SourceRecordRef,
24        output: StepOutput,
25    ) -> Self {
26        Self {
27            successor_step_id,
28            source,
29            output,
30        }
31    }
32
33    #[must_use]
34    pub const fn successor_step_id(&self) -> &StepId {
35        &self.successor_step_id
36    }
37
38    #[must_use]
39    pub const fn source(&self) -> &SourceRecordRef {
40        &self.source
41    }
42
43    #[must_use]
44    pub const fn output(&self) -> &StepOutput {
45        &self.output
46    }
47}