use {alloc::vec::Vec, hashbrown::HashMap}; #[derive(Debug, PartialEq, Clone)] pub struct Type {} #[derive(Debug, PartialEq, Clone)] pub struct Funct<'a> { takes: Vec<&'a str>, gives: Vec<&'a str>, } #[derive(Debug, PartialEq, Clone)] pub struct Protocol<'a> { types: HashMap<&'a str, Type>, fns: HashMap<&'a str, Funct<'a>>, } impl<'a> Protocol<'a> { pub fn void() -> Self { Self { types: HashMap::new(), fns: HashMap::new(), } } // Check if a protocol defines all types it needs too fn validate_protocol() -> bool { false } } impl<'a> From<&'a str> for Protocol<'a> { fn from(value: &'a str) -> Self { let mut hm_t = HashMap::new(); hm_t.insert(value, Type {}); Self { types: hm_t, fns: HashMap::new(), } } }