Skip to content

Commit 7e5c510

Browse files
committed
Add support for resolving 33-byte arrays, though its unused
1 parent 072a9e1 commit 7e5c510

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

c-bindings-gen/src/types.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
10371037
// Note that no !is_ref types can map to an array because Rust and C's call semantics
10381038
// for arrays are different (https://github.com/eqrion/cbindgen/issues/528)
10391039

1040+
"[u8; 33]" if !is_ref => Some("crate::c_types::ThirtyThreeBytes"),
10401041
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
10411042
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes"),
10421043
"[u8; 16]" if !is_ref => Some("crate::c_types::SixteenBytes"),
@@ -1145,6 +1146,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
11451146
"Option" if is_ref => Some("&local_"),
11461147
"Option" => Some("local_"),
11471148

1149+
"[u8; 33]" if !is_ref => Some(""),
11481150
"[u8; 32]" if is_ref => Some("unsafe { &*"),
11491151
"[u8; 32]" if !is_ref => Some(""),
11501152
"[u8; 20]" if !is_ref => Some(""),
@@ -1259,6 +1261,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
12591261
"Option" => Some(""),
12601262
"Result" if !is_ref => Some(""),
12611263

1264+
"[u8; 33]" if !is_ref => Some(".data"),
12621265
"[u8; 32]" if is_ref => Some("}"),
12631266
"[u8; 32]" if !is_ref => Some(".data"),
12641267
"[u8; 20]" if !is_ref => Some(".data"),
@@ -1373,6 +1376,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
13731376
"Vec" if !is_ref => Some("local_"),
13741377
"Option" => Some("local_"),
13751378

1379+
"[u8; 33]" if is_ref => Some(""),
13761380
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
13771381
"[u8; 32]" if is_ref => Some(""),
13781382
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes { data: "),
@@ -1477,6 +1481,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
14771481
"Vec" if !is_ref => Some(".into()"),
14781482
"Option" => Some(""),
14791483

1484+
"[u8; 33]" if is_ref => Some(""),
14801485
"[u8; 32]" if !is_ref => Some(" }"),
14811486
"[u8; 32]" if is_ref => Some(""),
14821487
"[u8; 20]" if !is_ref => Some(" }"),

0 commit comments

Comments
 (0)