fn initial_clonable_types() -> HashSet<String> {
let mut res = HashSet::new();
res.insert("crate::c_types::u5".to_owned());
+ res.insert("crate::c_types::FourBytes".to_owned());
+ res.insert("crate::c_types::TwelveBytes".to_owned());
+ res.insert("crate::c_types::SixteenBytes".to_owned());
+ res.insert("crate::c_types::TwentyBytes".to_owned());
res.insert("crate::c_types::ThirtyTwoBytes".to_owned());
res.insert("crate::c_types::SecretKey".to_owned());
res.insert("crate::c_types::PublicKey".to_owned());
res.insert("crate::c_types::TxOut".to_owned());
res.insert("crate::c_types::Signature".to_owned());
res.insert("crate::c_types::RecoverableSignature".to_owned());
+ res.insert("crate::c_types::Bech32Error".to_owned());
res.insert("crate::c_types::Secp256k1Error".to_owned());
res.insert("crate::c_types::IOError".to_owned());
+ res.insert("crate::c_types::Error".to_owned());
+ res.insert("crate::c_types::Str".to_owned());
+
+ // Because some types are manually-mapped to CVec_u8Z we may end up checking if its clonable
+ // before we ever get to constructing the type fully via
+ // `write_c_mangled_container_path_intern` (which will add it here too), so we have to manually
+ // add it on startup.
+ res.insert("crate::c_types::derived::CVec_u8Z".to_owned());
res
}
if let Some(t) = single_contained {
match t {
- syn::Type::Reference(_)|syn::Type::Path(_)|syn::Type::Slice(_) => {
+ syn::Type::Reference(_)|syn::Type::Path(_)|syn::Type::Slice(_)|syn::Type::Array(_) => {
let mut v = Vec::new();
let ret_ref = self.write_empty_rust_val_check_suffix(generics, &mut v, t);
let s = String::from_utf8(v).unwrap();
syn::Type::Path(p) => {
let resolved = self.resolve_path(&p.path, generics);
if let Some(arr_ty) = self.is_real_type_array(&resolved) {
- write!(w, ".data").unwrap();
return self.write_empty_rust_val_check_suffix(generics, w, &arr_ty);
}
if self.crate_types.opaques.get(&resolved).is_some() {
syn::Type::Array(a) => {
if let syn::Expr::Lit(l) = &a.len {
if let syn::Lit::Int(i) = &l.lit {
- write!(w, " == [0; {}]", i.base10_digits()).unwrap();
+ write!(w, ".data == [0; {}]", i.base10_digits()).unwrap();
EmptyValExpectedTy::NonPointer
} else { unimplemented!(); }
} else { unimplemented!(); }