More generics

This commit is contained in:
2026-05-08 17:09:01 +02:00
parent ed4a505a6a
commit bbcc639331
4 changed files with 27 additions and 11 deletions
+10 -5
View File
@@ -338,12 +338,14 @@ impl ToRust for TopLevelKind {
Self::EnumDecl {
visibility,
name,
generics,
fields,
} => {
cg.addln(&format!(
"{}enum {} {{",
"{}enum {}{} {{",
visibility.get_rust(),
name.get_rust()
name.get_rust(),
generics.get_rust()
));
cg.indent += 1;
@@ -357,15 +359,17 @@ impl ToRust for TopLevelKind {
Self::ClassDecl {
visibility,
name,
generics,
fields,
constructor,
methods,
} => {
// Struct decl
cg.addln(&format!(
"{}struct {} {{",
"{}struct {}{} {{",
visibility.get_rust(),
name.get_rust()
name.get_rust(),
generics.get_rust()
));
cg.indent += 1;
@@ -581,9 +585,10 @@ impl ToRust for FunctionDecl {
.join(", ");
cg.add_indentedln(&format!(
"{}fn {}({}) -> {} {{",
"{}fn {}{}({}) -> {} {{",
self.visibility.get_rust(),
self.name.get_rust(),
self.generics.get_rust(),
params_str,
self.return_type.get_rust()
));