diff --git a/src/common.rs b/src/common.rs index f2b5a9841d9ee1e0932f4ff1613058e1e2333993..1ff11a20ccb6325adb7d29720b5c100ea6213c23 100644 --- a/src/common.rs +++ b/src/common.rs @@ -44,12 +44,21 @@ pub enum Polarity { #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Copy, Clone, Debug)] pub struct Key(u64); +pub enum NewMainErr { + NoSuchComponent, + NonPortTypeParameters, + WrongNumberOfArguments { expected: usize }, + WrongPortPolarity { index: usize }, +} pub trait ProtocolDescription: Sized { type S: ComponentState; fn parse(pdl: &[u8]) -> Result; - fn main_interface_polarities(&self) -> Vec; - fn new_main_component(&self, interface: &[Key]) -> Self::S; + fn new_main_component( + &self, + identifier: &[u8], + ports: &[(Polarity, Key)], + ) -> Result; } pub trait ComponentState: Sized + Clone {