cairo_lang_sierra::extensions::types

Trait GenericType

Source
pub trait GenericType: Sized {
    type Concrete: ConcreteType;

    // Required methods
    fn by_id(id: &GenericTypeId) -> Option<Self>;
    fn specialize(
        &self,
        context: &dyn TypeSpecializationContext,
        args: &[GenericArg],
    ) -> Result<Self::Concrete, SpecializationError>;
}
Expand description

Trait for implementing a specialization generator for types.

Required Associated Types§

Required Methods§

Source

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

Instantiates the type by id.

Source

fn specialize( &self, context: &dyn TypeSpecializationContext, 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§