@@ -9,12 +9,12 @@ use crate::{Abi, Const, Field, Fn, Parameter, Static, Struct, Type, Union};
99/// Includes foreign functions/statics, type aliases, structs, unions, and constants.
1010#[ derive( Default , Clone , Debug ) ]
1111pub ( crate ) struct FfiItems {
12- aliases : Vec < Type > ,
13- structs : Vec < Struct > ,
14- unions : Vec < Union > ,
15- constants : Vec < Const > ,
16- foreign_functions : Vec < Fn > ,
17- foreign_statics : Vec < Static > ,
12+ pub ( crate ) aliases : Vec < Type > ,
13+ pub ( crate ) structs : Vec < Struct > ,
14+ pub ( crate ) unions : Vec < Union > ,
15+ pub ( crate ) constants : Vec < Const > ,
16+ pub ( crate ) foreign_functions : Vec < Fn > ,
17+ pub ( crate ) foreign_statics : Vec < Static > ,
1818}
1919
2020impl FfiItems {
@@ -24,15 +24,13 @@ impl FfiItems {
2424 }
2525
2626 /// Return whether the type has parsed a struct with the given identifier.
27- #[ expect( unused) ]
2827 pub ( crate ) fn contains_struct ( & self , ident : & str ) -> bool {
2928 self . structs ( )
3029 . iter ( )
3130 . any ( |structure| structure. ident ( ) == ident)
3231 }
3332
3433 /// Return whether the type has parsed a union with the given identifier.
35- #[ expect( unused) ]
3634 pub ( crate ) fn contains_union ( & self , ident : & str ) -> bool {
3735 self . unions ( ) . iter ( ) . any ( |union| union. ident ( ) == ident)
3836 }
@@ -106,7 +104,12 @@ fn visit_foreign_item_fn(table: &mut FfiItems, i: &syn::ForeignItemFn, abi: &Abi
106104 . iter ( )
107105 . map ( |arg| match arg {
108106 syn:: FnArg :: Typed ( arg) => Parameter {
109- pattern : arg. pat . deref ( ) . clone ( ) ,
107+ ident : match arg. pat . deref ( ) {
108+ syn:: Pat :: Ident ( i) => i. ident . to_string ( ) . into_boxed_str ( ) ,
109+ _ => {
110+ unimplemented ! ( "Foreign functions are unlikely to have any other pattern." )
111+ }
112+ } ,
110113 ty : arg. ty . deref ( ) . clone ( ) ,
111114 } ,
112115 syn:: FnArg :: Receiver ( _) => {
0 commit comments