Skip to main content

made_core/entities/
ranked_outcome.rs

1use serde::{Deserialize, Serialize};
2
3use crate::entities::{Proposal, ValidationOutcome};
4
5/// A proposal paired with its validation outcome and final rank.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct RankedOutcome {
8    proposal: Proposal,
9    outcome: ValidationOutcome,
10    rank: u32,
11}
12
13impl RankedOutcome {
14    #[must_use]
15    pub fn new(proposal: Proposal, outcome: ValidationOutcome, rank: u32) -> Self {
16        Self {
17            proposal,
18            outcome,
19            rank,
20        }
21    }
22
23    #[must_use]
24    pub fn proposal(&self) -> &Proposal {
25        &self.proposal
26    }
27
28    #[must_use]
29    pub fn outcome(&self) -> &ValidationOutcome {
30        &self.outcome
31    }
32
33    #[must_use]
34    pub fn rank(&self) -> u32 {
35        self.rank
36    }
37}