use crate::depot::capsules::{ReplayCapsuleEntry, StoredReplayEntryRef};
use crate::descriptor::{ProposalId, Row};
use crate::muterprater::proposal::types::{
DischargeAdmissionReceipt, ReplayAdmissionReceipt, SinkRefusal, StoredProposalRef,
};
impl StoredProposalRef {
pub fn at(proposal: ProposalId, token: &str) -> Result<Self, SinkRefusal> {
if token.is_empty() {
return Err(SinkRefusal::EmptyLocation);
}
Ok(Self {
proposal,
token: token.to_owned(),
})
}
#[must_use]
pub const fn proposal(&self) -> ProposalId {
self.proposal
}
#[must_use]
pub fn token(&self) -> &str {
&self.token
}
}
impl ReplayAdmissionReceipt {
#[must_use]
pub(in crate::muterprater) fn completed(
row: Row,
entry: ReplayCapsuleEntry,
proposal_custody: StoredProposalRef,
replay_custody: StoredReplayEntryRef,
) -> Self {
Self {
row,
entry,
proposal_custody,
replay_custody,
}
}
#[must_use]
pub const fn row(&self) -> &Row {
&self.row
}
#[must_use]
pub const fn entry(&self) -> &ReplayCapsuleEntry {
&self.entry
}
#[must_use]
pub const fn proposal_custody(&self) -> &StoredProposalRef {
&self.proposal_custody
}
#[must_use]
pub const fn replay_custody(&self) -> &StoredReplayEntryRef {
&self.replay_custody
}
}
impl DischargeAdmissionReceipt {
#[must_use]
pub(in crate::muterprater) fn completed(row: Row, proposal_custody: StoredProposalRef) -> Self {
Self {
row,
proposal_custody,
}
}
#[must_use]
pub const fn row(&self) -> &Row {
&self.row
}
#[must_use]
pub const fn proposal_custody(&self) -> &StoredProposalRef {
&self.proposal_custody
}
}