#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChainKind {
Then,
Fork,
}
#[derive(Debug, Clone, Copy)]
pub struct ChainStep {
pub name: &'static str,
pub kind: ChainKind,
}
#[derive(Debug, Clone, Copy)]
pub struct JigMeta {
pub name: &'static str,
pub file: &'static str,
pub line: u32,
pub kind: &'static str,
pub input: &'static str,
pub is_async: bool,
pub chain: &'static [ChainStep],
}
impl JigMeta {
pub fn chain_names(&self) -> impl Iterator<Item = &'static str> + '_ {
self.chain.iter().map(|s| s.name)
}
}
inventory::collect!(JigMeta);
pub fn all() -> impl Iterator<Item = &'static JigMeta> {
inventory::iter::<JigMeta>()
}
pub fn find(name: &str) -> Option<&'static JigMeta> {
all().find(|m| m.name == name)
}