pub trait GenericLibfunc: Sized {
type Concrete: ConcreteLibfunc;
// Required methods
fn supported_ids() -> Vec<GenericLibfuncId>;
fn by_id(id: &GenericLibfuncId) -> Option<Self>;
fn specialize_signature(
&self,
context: &dyn SignatureSpecializationContext,
args: &[GenericArg],
) -> Result<LibfuncSignature, SpecializationError>;
fn specialize(
&self,
context: &dyn SpecializationContext,
args: &[GenericArg],
) -> Result<Self::Concrete, SpecializationError>;
}
Expand description
Trait for implementing a libfunc specialization generator.
Required Associated Types§
Required Methods§
sourcefn supported_ids() -> Vec<GenericLibfuncId>
fn supported_ids() -> Vec<GenericLibfuncId>
Returns the list of generic libfuncs ids that can be instantiated through this type.
This is useful on hierarchical libfunc aggregates such as CoreLibfunc
.
sourcefn by_id(id: &GenericLibfuncId) -> Option<Self>
fn by_id(id: &GenericLibfuncId) -> Option<Self>
Instantiates the libfunc by id.
sourcefn specialize_signature(
&self,
context: &dyn SignatureSpecializationContext,
args: &[GenericArg],
) -> Result<LibfuncSignature, SpecializationError>
fn specialize_signature( &self, context: &dyn SignatureSpecializationContext, args: &[GenericArg], ) -> Result<LibfuncSignature, SpecializationError>
Creates the specialization of the libfunc’s signature with the template arguments.
sourcefn specialize(
&self,
context: &dyn SpecializationContext,
args: &[GenericArg],
) -> Result<Self::Concrete, SpecializationError>
fn specialize( &self, context: &dyn SpecializationContext, 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.