Function make_trait_impl
pub comptime fn make_trait_impl<Env1, Env2>(
s: TypeDefinition,
trait_name: Quoted,
function_signature: Quoted,
for_each_field: fn[Env1](Quoted) -> Quoted,
join_fields_with: Quoted,
body: fn[Env2](Quoted) -> Quoted,
) -> Quoted
make_implis a helper function to make a simple impl, usually while deriving a trait. This impl has a couple assumptions:function_signatureWhile these assumptions are met,
make_implwill create an impl from a TypeDefinition, automatically filling in the required generics from the type, along with the where clause. The function body is created by mapping each field withfor_each_fieldand joining the results withjoin_fields_with. The result of this is passed to thebodyfunction for any final processing - e.g. wrapping each field in aStructConstructor { .. }expression.See
derive_eqandderive_defaultfor example usage.