in src/bindgen/ir/union.rs [223:258]
fn instantiate_monomorph(
&self,
generic_values: &[GenericArgument],
library: &Library,
out: &mut Monomorphs,
) {
let mappings = self.generic_params.call(self.path.name(), generic_values);
let mangled_path = mangle::mangle_path(
&self.path,
generic_values,
&library.get_config().export.mangle,
);
let monomorph = Union::new(
mangled_path,
GenericParams::default(),
self.fields
.iter()
.map(|field| Field {
name: field.name.clone(),
ty: field.ty.specialize(&mappings),
cfg: field.cfg.clone(),
annotations: field.annotations.clone(),
documentation: field.documentation.clone(),
})
.collect(),
self.alignment,
self.tuple_union,
self.cfg.clone(),
self.annotations.clone(),
self.documentation.clone(),
);
out.insert_union(library, self, monomorph, generic_values.to_owned());
}