]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Support tuples containing array elements
authorMatt Corallo <git@bluematt.me>
Tue, 28 Feb 2023 23:31:11 +0000 (23:31 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 6 Mar 2023 04:16:09 +0000 (04:16 +0000)
c-bindings-gen/src/types.rs

index 64f2a688adf2441b51b196da4ffe5fb7b60933a8..73ba02a3e1dc87b4501c0a38990c5f4b12ef54dd 100644 (file)
@@ -2817,6 +2817,13 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                                                if let syn::Type::Path(p) = &*refelem.elem {
                                                                        write_path!(p, Some(&mut mangled_tuple_type));
                                                                } else { return false; }
+                                                       } else if let syn::Type::Array(_) = elem {
+                                                               let mut resolved = Vec::new();
+                                                               if !self.write_c_type_intern(&mut resolved, &elem, generics, false, false, true, false, true) { return false; }
+                                                               let array_inner = String::from_utf8(resolved).unwrap();
+                                                               let arr_name = array_inner.split("::").last().unwrap();
+                                                               write!(w, "{}", arr_name).unwrap();
+                                                               write!(mangled_type, "{}", arr_name).unwrap();
                                                        } else { return false; }
                                                }
                                                write!(w, "Z").unwrap();