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§