use crate::identity::{self, Identity, MACROONZ_STEM, OwnerFact, OwnerIdentity, Profile, Version};
use crate::kind::{Kind, Question, Role};
use crate::token::CapturedInput;
#[path = "type_guard.rs"]
mod guard;
pub const RUST_DECLARATION_PROFILE: Profile =
Profile::declared(MACROONZ_STEM, "rust-declaration", Version::declared(1));
pub const SELECTION_FACT: OwnerFact = OwnerFact {
home: "request",
name: "a-requests-selected-seats-are-its-complete-output-set",
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Producer {
pub namespace: &'static str,
pub name: &'static str,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CrateBinding {
spelling: &'static str,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Door {
prefix: &'static str,
grammar: &'static str,
entry: &'static str,
binding: CrateBinding,
producer: Producer,
}
#[must_use = "a request is a road nobody walked until it is rendered"]
pub struct Request<'door, K: Kind> {
capture: CapturedInput,
content: K::Content,
door: &'door Door,
dependencies: Vec<Identity<identity::CapturedDeclaration>>,
profile: Profile,
assumptions: Vec<OwnerFact>,
addresses: Vec<(K::Role, OwnerIdentity)>,
answers: Vec<<K::Question as Question>::Answer>,
selection: Selection<K::Role>,
}
pub(super) enum Selection<R: Role> {
All,
Declared { first: R, rest: Vec<R> },
}
pub(super) struct Statements<'request, R: Role> {
pub(super) assumptions: &'request [OwnerFact],
pub(super) addresses: &'request [(R, OwnerIdentity)],
pub(super) selection: &'request Selection<R>,
}