Skip to main content

made_core/value_objects/ceremony/
claim_disposition.rs

1use serde::{Deserialize, Serialize};
2
3use super::{ClaimDispositionKind, StepClaimFence, StepId};
4
5/// What a plan says about one outstanding claim, against the exact
6/// claim it observed.
7///
8/// The fence is carried so a plan cannot dispose of a claim that has
9/// since been replaced. A stale fence fails the plan rather than being
10/// ignored: the whole point of naming the claim is that the answer
11/// belongs to that claim and not to whatever holds the step now.
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13pub struct ClaimDisposition {
14    step_id: StepId,
15    claim_fence: StepClaimFence,
16    kind: ClaimDispositionKind,
17}
18
19impl ClaimDisposition {
20    #[must_use]
21    pub const fn new(
22        step_id: StepId,
23        claim_fence: StepClaimFence,
24        kind: ClaimDispositionKind,
25    ) -> Self {
26        Self {
27            step_id,
28            claim_fence,
29            kind,
30        }
31    }
32
33    #[must_use]
34    pub const fn step_id(&self) -> &StepId {
35        &self.step_id
36    }
37
38    #[must_use]
39    pub const fn claim_fence(&self) -> &StepClaimFence {
40        &self.claim_fence
41    }
42
43    #[must_use]
44    pub const fn kind(&self) -> &ClaimDispositionKind {
45        &self.kind
46    }
47}