Skip to main content

made_core/value_objects/ceremony/
budget_disposition.rs

1use serde::{Deserialize, Serialize};
2
3/// What a successor does about the ledger its predecessor was spending
4/// against.
5///
6/// Only [`Self::Fresh`] is honoured in this release.
7/// [`Self::TransferRemaining`] is spelled here rather than left out so
8/// a caller who wants it is refused with a reason instead of silently
9/// given something else: reservations, root accounting and refunds are
10/// held per ceremony, and moving a balance without the reservation
11/// ledger following it would leave two ceremonies believing they hold
12/// it.
13#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
14#[serde(rename_all = "snake_case")]
15pub enum BudgetDisposition {
16    Fresh,
17    TransferRemaining,
18}
19
20impl BudgetDisposition {
21    #[must_use]
22    pub const fn as_label(self) -> &'static str {
23        match self {
24            Self::Fresh => "fresh",
25            Self::TransferRemaining => "transfer_remaining",
26        }
27    }
28}