projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
58802e7
)
Correctly define the `native` type alias for enums with generic params
author
Matt Corallo
<git@bluematt.me>
Fri, 24 Jun 2022 01:18:00 +0000
(
01:18
+0000)
committer
Matt Corallo
<git@bluematt.me>
Fri, 24 Jun 2022 21:27:19 +0000
(21:27 +0000)
c-bindings-gen/src/main.rs
patch
|
blob
|
history
diff --git
a/c-bindings-gen/src/main.rs
b/c-bindings-gen/src/main.rs
index 88258632d81694a9c59be831125c9d60d98c9d24..b1d6161d6c45f7935a5f557dec556914728fbf9b 100644
(file)
--- a/
c-bindings-gen/src/main.rs
+++ b/
c-bindings-gen/src/main.rs
@@
-1661,7
+1661,10
@@
fn writeln_enum<'a, 'b, W: std::io::Write>(w: &mut W, e: &'a syn::ItemEnum, type
writeln!(&mut constr, "}}").unwrap();
writeln!(w, ",").unwrap();
}
writeln!(&mut constr, "}}").unwrap();
writeln!(w, ",").unwrap();
}
- writeln!(w, "}}\nuse {}::{} as native{};\nimpl {} {{", types.module_path, e.ident, e.ident, e.ident).unwrap();
+ writeln!(w, "}}\nuse {}::{} as {}Import;", types.module_path, e.ident, e.ident).unwrap();
+ write!(w, "pub(crate) type native{} = {}Import", e.ident, e.ident).unwrap();
+ maybe_write_generics(w, &e.generics, &types, true);
+ writeln!(w, ";\n\nimpl {} {{", e.ident).unwrap();
macro_rules! write_conv {
($fn_sig: expr, $to_c: expr, $ref: expr) => {
macro_rules! write_conv {
($fn_sig: expr, $to_c: expr, $ref: expr) => {