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 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>