X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Fblocks.rs;h=82b10ad831bd4ca2ef21ec3c1d9804d5dbe6e26c;hb=d3d51441b4cd98389308d4cfaba6548f25598c4c;hp=88172722efbda088aef61443fba43e2af6515e07;hpb=5eebd45b471833805e81ad4c23ec93d7711e0a23;p=ldk-c-bindings 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();