pub struct TierSpend {
pub tier: Tier,
pub meaning: String,
pub selected: usize,
pub excluded: usize,
pub tokens: u64,
pub required: usize,
}Expand description
What one tier cost, how much of it survived, and how much of that could not have been dropped.
There is no per-tier ceiling, which is worth saying because the name suggests one: the budget is a single pot spent in tier order, and this is the report of what each tier took from it, not an allowance it was given. A tier with many exclusions is therefore not a tier that hit its own limit — it is a tier that was reached after the pot had been spent by the tiers above it.
meaning is carried so that a reader deciding what to raise the budget for does not
have to look up what knowledge holds; required is the part of selected the budget
had no say over.
use majordomus_cli::devcontext::{Tier, TierSpend};
use serde_json::json;
let t: TierSpend = serde_json::from_value(json!({
"tier": "governance",
"meaning": Tier::Governance.meaning(),
"selected": 9,
"excluded": 2,
"tokens": 6_400,
"required": 3,
})).unwrap();
assert_eq!(t.tier, Tier::Governance);
// the undroppable part is a part of what survived, never a separate count
assert!(t.required <= t.selected);
// and the row explains its own tier, so "2 excluded" is actionable
assert_eq!(t.meaning, Tier::Governance.meaning());
assert!(t.meaning.contains("policy"));Fields§
§tier: TierThe tier.
meaning: StringWhat it is for.
selected: usizeHow many entries survived in it.
excluded: usizeHow many were dropped from it for budget.
tokens: u64Tokens the survivors cost.
required: usizeEntries in it that cannot be dropped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TierSpend
impl<'de> Deserialize<'de> for TierSpend
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for TierSpend
impl JsonSchema for TierSpend
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more