mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
[bindings] Expose a _clone fn for every enum
This somewhat assumes that every public enum implements clone in some way, but that is currently the case.
This commit is contained in:
parent
29b209ceea
commit
0362972d37
1 changed files with 4 additions and 0 deletions
|
@ -995,6 +995,10 @@ fn writeln_enum<'a, 'b, W: std::io::Write>(w: &mut W, e: &'a syn::ItemEnum, type
|
|||
if needs_free {
|
||||
writeln!(w, "#[no_mangle]\npub extern \"C\" fn {}_free(this_ptr: {}) {{ }}", e.ident, e.ident).unwrap();
|
||||
}
|
||||
writeln!(w, "#[no_mangle]").unwrap();
|
||||
writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{", e.ident, e.ident, e.ident).unwrap();
|
||||
writeln!(w, "\torig.clone()").unwrap();
|
||||
writeln!(w, "}}").unwrap();
|
||||
write_cpp_wrapper(cpp_headers, &format!("{}", e.ident), needs_free);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue