use crate::run;
use cranelift_entity::entity_impl;
pub struct State {
pub name: String,
pub extensions: Vec<String>,
}
impl State {
pub fn ext_matches(&self, ext: &str) -> bool {
self.extensions.iter().any(|e| e == ext)
}
pub fn is_pseudo(&self) -> bool {
self.extensions.is_empty()
}
}
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct StateRef(u32);
entity_impl!(StateRef, "state");
pub struct Operation {
pub name: String,
pub input: StateRef,
pub output: StateRef,
pub setups: Vec<SetupRef>,
pub emit: Box<dyn run::EmitBuild>,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct OpRef(u32);
entity_impl!(OpRef, "op");
pub struct Setup {
pub name: String,
pub emit: Box<dyn run::EmitSetup>,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct SetupRef(u32);
entity_impl!(SetupRef, "setup");