pub fn resolve(
        &self,
        id: &ast::Id,
        params: &[u64],
    ) -> Result<ast::Signature> {
        match self.definitions.get(id) {
            Some(prim) => {
                // zip param ids with passed in params into hashmap
                let param_map: HashMap<&ast::Id, u64> = prim
                    .params
                    .iter()
                    .zip(params)
                    .map(|(id, &width)| (id, width))
                    .collect();
                // resolve inputs
                let inputs_res: Result<Vec<ast::Portdef>> = prim
                    .signature
                    .inputs()
                    .map(|pd| pd.resolve(&id, &param_map))
                    .collect();
                // resolve outputs
                let outputs_res: Result<Vec<ast::Portdef>> = prim
                    .signature
                    .outputs()
                    .map(|pd| pd.resolve(&id, &param_map))
                    .collect();
                let inputs = inputs_res?;
                let outputs = outputs_res?;
                Ok(ast::Signature { inputs, outputs })
            }
            None => Err(Error::UndefinedComponent(id.clone())),
        }
    }
/// Given the id of a library primitive and a list of values for the params,
/// attempt to resolve a `ParamSignature` into a `Signature`
Given the id of a library primitive and a list of values for the params,
attempt to resolve a `ParamSignature` into a `Signature`
Given the id of a library primitive and a list of values for the params attempt to resolve a ` ParamSignature ` into a ` Signature `
pub fn resolve(
        &self,
        id: &ast::Id,
        params: &[u64],
    ) -> Result<ast::Signature> {
        match self.definitions.get(id) {
            Some(prim) => {
                // zip param ids with passed in params into hashmap
                let param_map: HashMap<&ast::Id, u64> = prim
                    .params
                    .iter()
                    .zip(params)
                    .map(|(id, &width)| (id, width))
                    .collect();
                // resolve inputs
                let inputs_res: Result<Vec<ast::Portdef>> = prim
                    .signature
                    .inputs()
                    .map(|pd| pd.resolve(&id, &param_map))
                    .collect();
                // resolve outputs
                let outputs_res: Result<Vec<ast::Portdef>> = prim
                    .signature
                    .outputs()
                    .map(|pd| pd.resolve(&id, &param_map))
                    .collect();
                let inputs = inputs_res?;
                let outputs = outputs_res?;
                Ok(ast::Signature { inputs, outputs })
            }
            None => Err(Error::UndefinedComponent(id.clone())),
        }
    }
pub fn resolve ( & self , id : & ast :: Id , params : & [ u64 ] , ) -> Result < ast :: Signature > { match self . definitions . get ( id ) { Some ( prim ) => { // zip param ids with passed in params into hashmap let param_map : HashMap < & ast :: Id , u64 > = prim . params . iter ( ) . zip ( params ) . map ( | ( id , & width ) | ( id , width ) ) . collect ( ) ; // resolve inputs let inputs_res : Result < Vec < ast :: Portdef > > = prim . signature . inputs ( ) . map ( | pd | pd . resolve ( & id , & param_map ) ) . collect ( ) ; // resolve outputs let outputs_res : Result < Vec < ast :: Portdef > > = prim . signature . outputs ( ) . map ( | pd | pd . resolve ( & id , & param_map ) ) . collect ( ) ; let inputs = inputs_res ? ; let outputs = outputs_res ? ; Ok ( ast :: Signature { inputs , outputs } ) } None => Err ( Error :: UndefinedComponent ( id . clone ( ) ) ) , } }
Given the id of a library primitive and a list of values for the params,
attempt to resolve a `ParamSignature` into a `Signature`
Given the id of a library primitive and a list of values for the params attempt to resolve a ` ParamSignature ` into a ` Signature `
&self
id
&ast::Id
params
&[u64]