pub fn as_abi_type(&self) -> AbiType {
        // converts a field element type
        fn fet_to_abi(fe: &FieldElementType) -> AbiFEType {
            match fe {
                FieldElementType::Private => noirc_abi::AbiFEType::Private,
                FieldElementType::Public => noirc_abi::AbiFEType::Public,
                FieldElementType::Constant => {
                    panic!("constant field in the ABI, this is not allowed!")
                }
            }
        }

        match self {
            Type::FieldElement(fe_type) => AbiType::Field(fet_to_abi(fe_type)),
            Type::Array(fe_type, size, typ) => match size {
                crate::ArraySize::Variable => {
                    panic!("cannot have variable sized array in entry point")
                }
                crate::ArraySize::Fixed(length) => AbiType::Array {
                    visibility: fet_to_abi(fe_type),
                    length: *length,
                    typ: Box::new(typ.as_abi_type()),
                },
            },
            Type::Integer(fe_type, sign, bit_width) => {
                let sign = match sign {
                    crate::Signedness::Unsigned => noirc_abi::Sign::Unsigned,
                    crate::Signedness::Signed => noirc_abi::Sign::Signed,
                };

                AbiType::Integer {
                    sign,
                    width: *bit_width as u32,
                    visibility: fet_to_abi(fe_type),
                }
            }
            Type::Bool => panic!("currently, cannot have a bool in the entry point function"),
            Type::Error => unreachable!(),
            Type::Unspecified => unreachable!(),
            Type::Unknown => unreachable!(),
            Type::Unit => unreachable!(),
        }
    }
// Note; use strict_eq instead of partial_eq when comparing field types
// in this method, you most likely want to distinguish between public and private
Note; use strict_eq instead of partial_eq when comparing field types
in this method, you most likely want to distinguish between public and private
Note ; use strict_eq instead of partial_eq when comparing field types in this method you most likely want to distinguish between public and private
pub fn as_abi_type(&self) -> AbiType {
        // converts a field element type
        fn fet_to_abi(fe: &FieldElementType) -> AbiFEType {
            match fe {
                FieldElementType::Private => noirc_abi::AbiFEType::Private,
                FieldElementType::Public => noirc_abi::AbiFEType::Public,
                FieldElementType::Constant => {
                    panic!("constant field in the ABI, this is not allowed!")
                }
            }
        }
        match self {
            Type::FieldElement(fe_type) => AbiType::Field(fet_to_abi(fe_type)),
            Type::Array(fe_type, size, typ) => match size {
                crate::ArraySize::Variable => {
                    panic!("cannot have variable sized array in entry point")
                }
                crate::ArraySize::Fixed(length) => AbiType::Array {
                    visibility: fet_to_abi(fe_type),
                    length: *length,
                    typ: Box::new(typ.as_abi_type()),
                },
            },
            Type::Integer(fe_type, sign, bit_width) => {
                let sign = match sign {
                    crate::Signedness::Unsigned => noirc_abi::Sign::Unsigned,
                    crate::Signedness::Signed => noirc_abi::Sign::Signed,
                };
                AbiType::Integer {
                    sign,
                    width: *bit_width as u32,
                    visibility: fet_to_abi(fe_type),
                }
            }
            Type::Bool => panic!("currently, cannot have a bool in the entry point function"),
            Type::Error => unreachable!(),
            Type::Unspecified => unreachable!(),
            Type::Unknown => unreachable!(),
            Type::Unit => unreachable!(),
        }
    }
pub fn as_abi_type ( & self ) -> AbiType { // converts a field element type fn fet_to_abi ( fe : & FieldElementType ) -> AbiFEType { match fe { FieldElementType :: Private => noirc_abi :: AbiFEType :: Private , FieldElementType :: Public => noirc_abi :: AbiFEType :: Public , FieldElementType :: Constant => { panic ! ( " " ) } } } match self { Type :: FieldElement ( fe_type ) => AbiType :: Field ( fet_to_abi ( fe_type ) ) , Type :: Array ( fe_type , size , typ ) => match size { crate :: ArraySize :: Variable => { panic ! ( " " ) } crate :: ArraySize :: Fixed ( length ) => AbiType :: Array { visibility : fet_to_abi ( fe_type ) , length : * length , typ : Box :: new ( typ . as_abi_type ( ) ) , } , } , Type :: Integer ( fe_type , sign , bit_width ) => { let sign = match sign { crate :: Signedness :: Unsigned => noirc_abi :: Sign :: Unsigned , crate :: Signedness :: Signed => noirc_abi :: Sign :: Signed , } ; AbiType :: Integer { sign , width : * bit_width as u32 , visibility : fet_to_abi ( fe_type ) , } } Type :: Bool => panic ! ( " " ) , Type :: Error => unreachable ! ( ) , Type :: Unspecified => unreachable ! ( ) , Type :: Unknown => unreachable ! ( ) , Type :: Unit => unreachable ! ( ) , } }
Note; use strict_eq instead of partial_eq when comparing field types
in this method, you most likely want to distinguish between public and private
Note ; use strict_eq instead of partial_eq when comparing field types in this method you most likely want to distinguish between public and private
&self
&self