pub trait NamedType: Default {
type Concrete: ConcreteType;
const ID: GenericTypeId;
// Required method
fn specialize(
&self,
context: &dyn TypeSpecializationContext,
args: &[GenericArg],
) -> Result<Self::Concrete, SpecializationError>;
// Provided methods
fn id() -> GenericTypeId { ... }
fn concrete_type_long_id(generic_args: &[GenericArg]) -> ConcreteTypeLongId { ... }
}
Expand description
Trait for implementing a specialization generator with with a simple id.
Required Associated Constants§
const ID: GenericTypeId
Required Associated Types§
type Concrete: ConcreteType
Required Methods§
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.
Provided Methods§
Sourcefn id() -> GenericTypeId
fn id() -> GenericTypeId
Returns the generic id of named types.
Sourcefn concrete_type_long_id(generic_args: &[GenericArg]) -> ConcreteTypeLongId
fn concrete_type_long_id(generic_args: &[GenericArg]) -> ConcreteTypeLongId
Returns the long ID of the concrete type with ID
as the generic ID and the given args.
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.