From: Matt Corallo Date: Tue, 12 Oct 2021 02:09:03 +0000 (+0000) Subject: Correctly convert Option> to C X-Git-Tag: v0.0.102.0^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=021a4af2ba45c2191568ec347d871df57206917e;p=ldk-c-bindings Correctly convert Option> to C --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 9220dd1..f87e2a0 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1374,10 +1374,10 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { ], " }", ContainerPrefixLocation::OutsideConv)); } } else if self.is_primitive(&inner_path) || self.c_type_from_path(&inner_path, false, false).is_none() { - let inner_name = inner_path.rsplit("::").next().unwrap(); + let inner_name = self.get_c_mangled_container_type(vec![single_contained.unwrap()], generics, "Option").unwrap(); return Some(("if ", vec![ - (format!(".is_none() {{ {}::COption_{}Z::None }} else {{ {}::COption_{}Z::Some(", - Self::generated_container_path(), inner_name, Self::generated_container_path(), inner_name), + (format!(".is_none() {{ {}::None }} else {{ {}::Some(", + inner_name, inner_name), format!("{}.unwrap()", var_access)) ], ") }", ContainerPrefixLocation::PerConv)); } else {