X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Fblocks.rs;h=82b10ad831bd4ca2ef21ec3c1d9804d5dbe6e26c;hp=88172722efbda088aef61443fba43e2af6515e07;hb=9e7c25670d70934a62f711c71e651854321c0d7b;hpb=02a763d73edf5b792a4a9cc5f2acbbe997a6102e diff --git a/c-bindings-gen/src/blocks.rs b/c-bindings-gen/src/blocks.rs index 8817272..82b10ad 100644 --- a/c-bindings-gen/src/blocks.rs +++ b/c-bindings-gen/src/blocks.rs @@ -137,12 +137,8 @@ pub fn write_result_block(w: &mut W, mangled_container: &str, writeln!(w, "\t}}").unwrap(); writeln!(w, "}}").unwrap(); - // TODO: Templates should use () now that they can, too - let templ_ok_type = if ok_type != "()" { ok_type } else { "u8" }; - let templ_err_type = if err_type != "()" { err_type } else { "u8" }; - - writeln!(w, "impl From> for {} {{", templ_ok_type, templ_err_type, mangled_container).unwrap(); - writeln!(w, "\tfn from(mut o: crate::c_types::CResultTempl<{}, {}>) -> Self {{", templ_ok_type, templ_err_type).unwrap(); + writeln!(w, "impl From> for {} {{", ok_type, err_type, mangled_container).unwrap(); + writeln!(w, "\tfn from(mut o: crate::c_types::CResultTempl<{}, {}>) -> Self {{", ok_type, err_type).unwrap(); writeln!(w, "\t\tlet contents = if o.result_ok {{").unwrap(); if ok_type != "()" { writeln!(w, "\t\t\tlet result = unsafe {{ o.contents.result }};").unwrap();