cairo_lang_sierra::extensions::lib_func

Trait SignatureSpecializationContext

source
pub trait SignatureSpecializationContext: TypeSpecializationContext {
    // Required methods
    fn try_get_concrete_type(
        &self,
        id: GenericTypeId,
        generic_args: &[GenericArg],
    ) -> Option<ConcreteTypeId>;
    fn try_get_function_signature(
        &self,
        function_id: &FunctionId,
    ) -> Option<FunctionSignature>;
    fn try_get_function_ap_change(
        &self,
        function_id: &FunctionId,
    ) -> Option<SierraApChange>;
    fn as_type_specialization_context(&self) -> &dyn TypeSpecializationContext;

    // Provided methods
    fn get_concrete_type(
        &self,
        id: GenericTypeId,
        generic_args: &[GenericArg],
    ) -> Result<ConcreteTypeId, SpecializationError> { ... }
    fn get_function_signature(
        &self,
        function_id: &FunctionId,
    ) -> Result<FunctionSignature, SpecializationError> { ... }
    fn get_function_ap_change(
        &self,
        function_id: &FunctionId,
    ) -> Result<SierraApChange, SpecializationError> { ... }
    fn get_wrapped_concrete_type(
        &self,
        id: GenericTypeId,
        wrapped: ConcreteTypeId,
    ) -> Result<ConcreteTypeId, SpecializationError> { ... }
}
Expand description

Trait for the specialization of libfunc signatures.

Required Methods§

source

fn try_get_concrete_type( &self, id: GenericTypeId, generic_args: &[GenericArg], ) -> Option<ConcreteTypeId>

Returns concrete type id given a generic type and the generic arguments.

source

fn try_get_function_signature( &self, function_id: &FunctionId, ) -> Option<FunctionSignature>

Returns the function’s signature object associated with the given FunctionId.

source

fn try_get_function_ap_change( &self, function_id: &FunctionId, ) -> Option<SierraApChange>

Returns the ap-change of the given function.

source

fn as_type_specialization_context(&self) -> &dyn TypeSpecializationContext

Upcasting to the TypeSpecializationContext, since trait upcasting is still experimental.

Provided Methods§

source

fn get_concrete_type( &self, id: GenericTypeId, generic_args: &[GenericArg], ) -> Result<ConcreteTypeId, SpecializationError>

Wraps Self::try_get_concrete_type with a result object.

source

fn get_function_signature( &self, function_id: &FunctionId, ) -> Result<FunctionSignature, SpecializationError>

Wraps Self::try_get_function_signature with a result object.

source

fn get_function_ap_change( &self, function_id: &FunctionId, ) -> Result<SierraApChange, SpecializationError>

Wraps Self::try_get_function_ap_change with a result object.

source

fn get_wrapped_concrete_type( &self, id: GenericTypeId, wrapped: ConcreteTypeId, ) -> Result<ConcreteTypeId, SpecializationError>

Returns the concrete id of T<S> given generic type T and concrete type S.

Implementors§