cairo_lang_sierra::extensions::lib_func

Trait GenericLibfunc

source
pub trait GenericLibfunc: Sized {
    type Concrete: ConcreteLibfunc;

    // Required methods
    fn supported_ids() -> Vec<GenericLibfuncId>;
    fn by_id(id: &GenericLibfuncId) -> Option<Self>;
    fn specialize_signature(
        &self,
        context: &dyn SignatureSpecializationContext,
        args: &[GenericArg],
    ) -> Result<LibfuncSignature, SpecializationError>;
    fn specialize(
        &self,
        context: &dyn SpecializationContext,
        args: &[GenericArg],
    ) -> Result<Self::Concrete, SpecializationError>;
}
Expand description

Trait for implementing a libfunc specialization generator.

Required Associated Types§

Required Methods§

source

fn supported_ids() -> Vec<GenericLibfuncId>

Returns the list of generic libfuncs ids that can be instantiated through this type. This is useful on hierarchical libfunc aggregates such as CoreLibfunc.

source

fn by_id(id: &GenericLibfuncId) -> Option<Self>

Instantiates the libfunc by id.

source

fn specialize_signature( &self, context: &dyn SignatureSpecializationContext, args: &[GenericArg], ) -> Result<LibfuncSignature, SpecializationError>

Creates the specialization of the libfunc’s signature with the template arguments.

source

fn specialize( &self, context: &dyn SpecializationContext, args: &[GenericArg], ) -> Result<Self::Concrete, SpecializationError>

Creates the specialization with the template arguments.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

source§

impl GenericLibfunc for CoreLibfunc

source§

impl GenericLibfunc for ApTrackingLibfunc

source§

impl GenericLibfunc for ArrayLibfunc

source§

impl GenericLibfunc for BoolLibfunc

source§

impl GenericLibfunc for BoundedIntLibfunc

source§

impl GenericLibfunc for BoxLibfunc

source§

impl GenericLibfunc for Bytes31Libfunc

source§

impl GenericLibfunc for CastLibfunc

source§

impl GenericLibfunc for CircuitLibFunc

source§

impl GenericLibfunc for ConstLibfunc

source§

impl GenericLibfunc for CouponLibfunc

source§

impl GenericLibfunc for DebugLibfunc

source§

impl GenericLibfunc for EcLibfunc

source§

impl GenericLibfunc for EnumLibfunc

source§

impl GenericLibfunc for Felt252BinaryOperationLibfunc

source§

impl GenericLibfunc for Felt252Libfunc

source§

impl GenericLibfunc for Felt252DictEntryLibfunc

source§

impl GenericLibfunc for Felt252DictLibfunc

source§

impl GenericLibfunc for GasLibfunc

source§

impl GenericLibfunc for Sint128Libfunc

source§

impl GenericLibfunc for Uint128Libfunc

source§

impl GenericLibfunc for Uint256Libfunc

source§

impl GenericLibfunc for Uint512Libfunc

source§

impl GenericLibfunc for MemLibfunc

source§

impl GenericLibfunc for NullableLibfunc

source§

impl GenericLibfunc for PedersenLibfunc

source§

impl GenericLibfunc for PoseidonLibfunc

source§

impl GenericLibfunc for IntRangeLibfunc

source§

impl GenericLibfunc for StarkNetLibfunc

source§

impl GenericLibfunc for Secp256Libfunc

source§

impl GenericLibfunc for TestingLibfunc

source§

impl GenericLibfunc for StructLibfunc

source§

impl GenericLibfunc for Felt252BinaryOperationWithConstLibfunc

source§

impl GenericLibfunc for Felt252BinaryOperationWithVarLibfunc

source§

impl<T: Secp256Trait> GenericLibfunc for Secp256OpLibfunc<T>

source§

impl<TNamedLibfunc: NamedLibfunc> GenericLibfunc for TNamedLibfunc

source§

type Concrete = <TNamedLibfunc as NamedLibfunc>::Concrete

source§

impl<TSintTraits: SintTraits + IntMulTraits + IsZeroTraits> GenericLibfunc for SintLibfunc<TSintTraits>

source§

type Concrete = SintConcrete<TSintTraits>

source§

impl<TSintTraits: SintTraits> GenericLibfunc for SintOperationLibfunc<TSintTraits>

source§

impl<TUintTraits: UintTraits + IntMulTraits + IsZeroTraits> GenericLibfunc for UintLibfunc<TUintTraits>

source§

type Concrete = UintConcrete<TUintTraits>

source§

impl<TUintTraits: UintTraits> GenericLibfunc for UintOperationLibfunc<TUintTraits>