Ignore `Send` and `Sync` bounds when resolving generics
[ldk-c-bindings] / c-bindings-gen / src / types.rs
index 1cb7420e7d8c8686c73fed2038fc6fb69113459b..f83c62741074039f8dce268b1df9f9486d0fca5d 100644 (file)
@@ -294,6 +294,8 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
                                                                if let syn::TypeParamBound::Trait(trait_bound) = bound {
                                                                        if let Some(id) = trait_bound.path.get_ident() {
                                                                                if format!("{}", id) == "Sized" { continue; }
+                                                                               if format!("{}", id) == "Send" { continue; }
+                                                                               if format!("{}", id) == "Sync" { continue; }
                                                                        }
                                                                        if non_lifetimes_processed { return false; }
                                                                        non_lifetimes_processed = true;
@@ -1534,7 +1536,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                if is_ref => Some(".as_inner()"),
                        "bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"
                                if !is_ref => Some(".into_inner() }"),
-                       "bitcoin::blockdata::constants::ChainHash" if is_ref => Some(".as_bytes() }"),
+                       "bitcoin::blockdata::constants::ChainHash" if is_ref => Some(".as_bytes()"),
                        "bitcoin::blockdata::constants::ChainHash" if !is_ref => Some(".to_bytes() }"),
                        "bitcoin::secp256k1::Message" if !is_ref => Some(".as_ref().clone() }"),
                        "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret"