From: Matt Corallo Date: Sat, 22 Jul 2023 17:38:46 +0000 (+0000) Subject: Support Unit struct types X-Git-Tag: v0.0.116.0^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=dda9d452eb175033fa8ecb29f2396c79a05162cb;p=ldk-c-bindings Support Unit struct types --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 28cce19..2cd4664 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -805,7 +805,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, define_field!(('a' as u8 + idx as u8) as char, ('0' as u8 + idx as u8) as char, field); } } - _ => unimplemented!() + syn::Fields::Unit => {}, } if all_fields_settable { @@ -828,7 +828,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, types.write_c_type(w, &field.ty, Some(&gen_types), false); } } - _ => unreachable!() + syn::Fields::Unit => {}, } write!(w, ") -> {} {{\n\t", struct_name).unwrap(); match &s.fields { @@ -848,7 +848,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, } } }, - _ => unreachable!() + syn::Fields::Unit => {}, } write!(w, "{} {{ inner: ObjOps::heap_alloc(", struct_name).unwrap(); match &s.fields { @@ -876,7 +876,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, } write!(w, "\t)").unwrap(); }, - _ => unreachable!() + syn::Fields::Unit => write!(w, "{}::{} {{}}", types.module_path, struct_name).unwrap(), } writeln!(w, "), is_owned: true }}\n}}").unwrap(); }