Implement struct toposort
diff --git a/gen/src/write.rs b/gen/src/write.rs
index c806e55..414ea46 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -76,14 +76,8 @@
}
}
- for api in toposort::sort(apis, out.types) {
+ for api in apis {
match api {
- Api::Struct(strct) => {
- out.next_section();
- if !out.types.cxx.contains(&strct.name.rust) {
- write_struct(out, strct);
- }
- }
Api::Enum(enm) => {
out.next_section();
if out.types.cxx.contains(&enm.name.rust) {
@@ -102,6 +96,13 @@
}
}
+ for strct in toposort::sort(apis, out.types) {
+ out.next_section();
+ if !out.types.cxx.contains(&strct.name.rust) {
+ write_struct(out, strct);
+ }
+ }
+
out.next_section();
for api in apis {
if let Api::TypeAlias(ety) = api {