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§
type Concrete: ConcreteType
Required Methods§
sourcefn by_id(id: &GenericTypeId) -> Option<Self>
fn by_id(id: &GenericTypeId) -> Option<Self>
Instantiates the type by id.
sourcefn specialize(
&self,
context: &dyn TypeSpecializationContext,
args: &[GenericArg],
) -> Result<Self::Concrete, SpecializationError>
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.