X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Ftypes.rs;h=d53801959deb67c8fa2f568626719587aabb9d3e;hb=7ab19163bac30ec500d40f1c3f9ba6efad3d0966;hp=aebeb487ece66605a3770677b9d386041bc29a13;hpb=defa610aab6b181a88423c8a67cfd24bbea6e05e;p=ldk-c-bindings diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index aebeb48..d538019 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -352,7 +352,7 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { } } -trait ResolveType<'a> { fn resolve_type(&'a self, ty: &'a syn::Type) -> &'a syn::Type; } +pub trait ResolveType<'a> { fn resolve_type(&'a self, ty: &'a syn::Type) -> &'a syn::Type; } impl<'a, 'b, 'c: 'a + 'b> ResolveType<'c> for Option<&GenericTypes<'a, 'b>> { fn resolve_type(&'c self, ty: &'c syn::Type) -> &'c syn::Type { if let Some(us) = self { @@ -513,14 +513,7 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr }, syn::Item::Type(t) if export_status(&t.attrs) == ExportStatus::Export => { if let syn::Visibility::Public(_) = t.vis { - let mut process_alias = true; - for tok in t.generics.params.iter() { - if let syn::GenericParam::Lifetime(_) = tok {} - else { process_alias = false; } - } - if process_alias { - declared.insert(t.ident.clone(), DeclType::StructImported { generics: &t.generics }); - } + declared.insert(t.ident.clone(), DeclType::StructImported { generics: &t.generics }); } }, syn::Item::Enum(e) => { @@ -723,6 +716,7 @@ fn initial_clonable_types() -> HashSet { let mut res = HashSet::new(); res.insert("crate::c_types::u5".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::Transaction".to_owned()); res.insert("crate::c_types::TxOut".to_owned()); @@ -738,6 +732,8 @@ pub struct CrateTypes<'a> { /// This may contain structs or enums, but only when either is mapped as /// struct X { inner: *mut originalX, .. } pub opaques: HashMap, + /// structs that weren't exposed + pub priv_structs: HashMap, /// Enums which are mapped as C enums with conversion functions pub mirrored_enums: HashMap, /// Traits which are mapped as a pointer + jump table @@ -767,7 +763,7 @@ impl<'a> CrateTypes<'a> { CrateTypes { opaques: HashMap::new(), mirrored_enums: HashMap::new(), traits: HashMap::new(), type_aliases: HashMap::new(), reverse_alias_map: HashMap::new(), - templates_defined: RefCell::new(HashMap::default()), + templates_defined: RefCell::new(HashMap::default()), priv_structs: HashMap::new(), clonable_types: RefCell::new(initial_clonable_types()), trait_impls: HashMap::new(), template_file: RefCell::new(template_file), lib_ast: &libast, }