use crate::closure::Closure;
use crate::explanation::View;
use crate::identity::{ClosedExpansionId, ClosureId, OwnerFact, PlanId, Provenance};
use crate::kind::{DispositionSet, Kind, KindSet};
use crate::plan::Plan;
#[path = "type_guard.rs"]
mod guard;
pub const BINDING_FACT: OwnerFact = OwnerFact {
home: "expansion",
name: "nothing-is-handed-out-that-did-not-bind",
};
#[must_use = "a binding refusal names the two identities an expansion was asked to bind as one"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BindError {
ClosureProvedAgainstAnotherPlan {
planned: PlanId,
proved: PlanId,
},
ExplanationAnsweredOverAnotherPlan {
planned: PlanId,
answered: PlanId,
},
ExplanationAnsweredOverAnotherClosure {
proved: ClosureId,
answered: ClosureId,
},
}
#[must_use = "an expansion is the whole account one request produced, and the only road to tokens"]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Expansion<K: Kind> {
identity: ClosedExpansionId,
provenance: Provenance,
plan: Plan<K>,
closure: Closure<K::Role>,
explanation: View<K>,
}
#[must_use = "an accounted expansion is what one door produced and what happened to every kind it did not"]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Accounted<K: Kind, Set: KindSet> {
expansion: Expansion<K>,
dispositions: DispositionSet<Set>,
}