Skip to content

Commit

Permalink
Merge pull request #15 from dtolnay/opaque
Browse files Browse the repository at this point in the history
Support opaque types that are not structs
  • Loading branch information
dtolnay authored Jan 21, 2020
2 parents 199d735 + 8861bee commit 270b885
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gen/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub(super) fn gen(namespace: Vec<String>, apis: &[Api], types: &Types, header: b
for api in apis {
match api {
Api::Struct(strct) => write_struct_decl(out, &strct.ident),
Api::CxxType(ety) | Api::RustType(ety) => write_struct_decl(out, &ety.ident),
Api::CxxType(ety) => write_struct_using(out, &ety.ident),
Api::RustType(ety) => write_struct_decl(out, &ety.ident),
_ => {}
}
}
Expand Down Expand Up @@ -167,6 +168,10 @@ fn write_struct_decl(out: &mut OutFile, ident: &Ident) {
writeln!(out, "struct {};", ident);
}

fn write_struct_using(out: &mut OutFile, ident: &Ident) {
writeln!(out, "using {} = {};", ident, ident);
}

fn write_cxx_function_shim(out: &mut OutFile, efn: &ExternFn, types: &Types) {
let indirect_return = efn
.ret
Expand Down

0 comments on commit 270b885

Please sign in to comment.