@@ -867,10 +867,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
867
867
return Some ( full_path) ;
868
868
}
869
869
match full_path {
870
- "Result" => Some ( "crate::c_types::derived::CResult" ) ,
871
- "Vec" if !is_ref => Some ( "crate::c_types::derived::CVec" ) ,
872
- "Option" => Some ( "" ) ,
873
-
874
870
// Note that no !is_ref types can map to an array because Rust and C's call semantics
875
871
// for arrays are different (https://github.com/eqrion/cbindgen/issues/528)
876
872
@@ -906,7 +902,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
906
902
"bitcoin::blockdata::script::Script" if is_ref => Some ( "crate::c_types::u8slice" ) ,
907
903
"bitcoin::blockdata::script::Script" if !is_ref => Some ( "crate::c_types::derived::CVec_u8Z" ) ,
908
904
"bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::lightning::chain::transaction::OutPoint" ) ,
909
- "bitcoin::blockdata::transaction::Transaction" => Some ( "crate::c_types::Transaction" ) ,
905
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" => Some ( "crate::c_types::Transaction" ) ,
910
906
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "crate::c_types::TxOut" ) ,
911
907
"bitcoin::network::constants::Network" => Some ( "crate::bitcoin::network::Network" ) ,
912
908
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some ( "*const [u8; 80]" ) ,
@@ -989,8 +985,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
989
985
if !is_ref => Some ( "" ) ,
990
986
"bitcoin::blockdata::script::Script" if is_ref => Some ( "&::bitcoin::blockdata::script::Script::from(Vec::from(" ) ,
991
987
"bitcoin::blockdata::script::Script" if !is_ref => Some ( "::bitcoin::blockdata::script::Script::from(" ) ,
992
- "bitcoin::blockdata::transaction::Transaction" if is_ref => Some ( "&" ) ,
993
- "bitcoin::blockdata::transaction::Transaction" => Some ( "" ) ,
988
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" if is_ref => Some ( "&" ) ,
989
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" => Some ( "" ) ,
994
990
"bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::c_types::C_to_bitcoin_outpoint(" ) ,
995
991
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "" ) ,
996
992
"bitcoin::network::constants::Network" => Some ( "" ) ,
@@ -1066,7 +1062,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1066
1062
if is_ref => Some ( "}[..]).unwrap()" ) ,
1067
1063
"bitcoin::blockdata::script::Script" if is_ref => Some ( ".to_slice()))" ) ,
1068
1064
"bitcoin::blockdata::script::Script" if !is_ref => Some ( ".into_rust())" ) ,
1069
- "bitcoin::blockdata::transaction::Transaction" => Some ( ".into_bitcoin()" ) ,
1065
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" => Some ( ".into_bitcoin()" ) ,
1070
1066
"bitcoin::blockdata::transaction::OutPoint" => Some ( ")" ) ,
1071
1067
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( ".into_rust()" ) ,
1072
1068
"bitcoin::network::constants::Network" => Some ( ".into_bitcoin()" ) ,
@@ -1157,8 +1153,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1157
1153
if !is_ref => Some ( "crate::c_types::Secp256k1Error::from_rust(" ) ,
1158
1154
"bitcoin::blockdata::script::Script" if is_ref => Some ( "crate::c_types::u8slice::from_slice(&" ) ,
1159
1155
"bitcoin::blockdata::script::Script" if !is_ref => Some ( "" ) ,
1160
- "bitcoin::blockdata::transaction::Transaction" if is_ref => Some ( "crate::c_types::Transaction::from_bitcoin(" ) ,
1161
- "bitcoin::blockdata::transaction::Transaction" => Some ( "crate::c_types::Transaction::from_bitcoin(&" ) ,
1156
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" if is_ref => Some ( "crate::c_types::Transaction::from_bitcoin(" ) ,
1157
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" => Some ( "crate::c_types::Transaction::from_bitcoin(&" ) ,
1162
1158
"bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::c_types::bitcoin_to_C_outpoint(" ) ,
1163
1159
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "crate::c_types::TxOut::from_rust(" ) ,
1164
1160
"bitcoin::network::constants::Network" => Some ( "crate::bitcoin::network::Network::from_bitcoin(" ) ,
@@ -1231,7 +1227,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1231
1227
if !is_ref => Some ( ")" ) ,
1232
1228
"bitcoin::blockdata::script::Script" if is_ref => Some ( "[..])" ) ,
1233
1229
"bitcoin::blockdata::script::Script" if !is_ref => Some ( ".into_bytes().into()" ) ,
1234
- "bitcoin::blockdata::transaction::Transaction" => Some ( ")" ) ,
1230
+ "bitcoin::blockdata::transaction::Transaction" | "bitcoin::Transaction" => Some ( ")" ) ,
1235
1231
"bitcoin::blockdata::transaction::OutPoint" => Some ( ")" ) ,
1236
1232
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( ")" ) ,
1237
1233
"bitcoin::network::constants::Network" => Some ( ")" ) ,
@@ -1378,10 +1374,10 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1378
1374
] , " }" , ContainerPrefixLocation :: OutsideConv ) ) ;
1379
1375
}
1380
1376
} else if self . is_primitive ( & inner_path) || self . c_type_from_path ( & inner_path, false , false ) . is_none ( ) {
1381
- let inner_name = inner_path . rsplit ( "::" ) . next ( ) . unwrap ( ) ;
1377
+ let inner_name = self . get_c_mangled_container_type ( vec ! [ single_contained . unwrap ( ) ] , generics , "Option" ) . unwrap ( ) ;
1382
1378
return Some ( ( "if " , vec ! [
1383
- ( format!( ".is_none() {{ {}::COption_{}Z:: None }} else {{ {}::COption_{}Z ::Some(" ,
1384
- Self :: generated_container_path ( ) , inner_name, Self :: generated_container_path ( ) , inner_name) ,
1379
+ ( format!( ".is_none() {{ {}::None }} else {{ {}::Some(" ,
1380
+ inner_name, inner_name) ,
1385
1381
format!( "{}.unwrap()" , var_access) )
1386
1382
] , ") }" , ContainerPrefixLocation :: PerConv ) ) ;
1387
1383
} else {
0 commit comments