/// Validates the parsed function and code section lengths match.
Validates the parsed function and code section lengths match.
Validates the parsed function and code section lengths match .
fn validate_function_counts(
    codes: Option<&Vec<(ResultType, Expression)>>,
    signatures: Option<&Vec<TypeIndex>>,
) -> Result<(), ParseError> {
    if codes.is_none() && signatures.is_none() {
        return Ok(());
    }
    let code_count = codes.as_ref().map(|v| v.len());
    let signature_count = signatures.as_ref().map(|v| v.len());
    let lengths_match = code_count.zip(signature_count).filter(|(a, b)| a == b);
    lengths_match
        .map(|_| ())
        .ok_or(ParseError::MismatchedFunctionParts(
            code_count,
            signature_count,
        ))
}
fn validate_function_counts ( codes : Option < & Vec < ( ResultType , Expression ) > > , signatures : Option < & Vec < TypeIndex > > , ) -> Result < ( ) , ParseError > { if codes . is_none ( ) && signatures . is_none ( ) { return Ok ( ( ) ) ; } let code_count = codes . as_ref ( ) . map ( | v | v . len ( ) ) ; let signature_count = signatures . as_ref ( ) . map ( | v | v . len ( ) ) ; let lengths_match = code_count . zip ( signature_count ) . filter ( | ( a , b ) | a == b ) ; lengths_match . map ( | _ | ( ) ) . ok_or ( ParseError :: MismatchedFunctionParts ( code_count , signature_count , ) ) }
Validates the parsed function and code section lengths match.
Validates the parsed function and code section lengths match .
codes
Option<&Vec<(ResultType, Expression)>>
signatures
Option<&Vec<TypeIndex>>