fn filter_fn_ptr_items<'a>(
            bindings_tree: &'a syn::File,
            module_name: &str,
        ) -> Vec<&'a ForeignItemStatic> {
            let (_, root_mod_items) = match bindings_tree.items.as_slice() {
                [Item::Mod(ItemMod {
                    ident: id,
                    content: Some(c),
                    ..
                })] if id == "root" => c,
                _ => panic!("root mod not found"),
            };
            let (_, fn_ptr_mod_items) = root_mod_items
                .iter()
                .find_map(|item| match item {
                    Item::Mod(ItemMod {
                        ident: id,
                        content: Some(c),
                        ..
                    }) if id == module_name => Some(c),
                    _ => None,
                })
                .expect("function pointer mod not found");
            fn_ptr_mod_items
                .iter()
                .filter_map(|item| match item {
                    Item::ForeignMod(ItemForeignMod { items, .. }) => match items.as_slice() {
                        [ForeignItem::Static(i)] => Some(i),
                        _ => None,
                    },
                    _ => None,
                })
                .collect()
        }
/// Extracts the items of the given `bindings.rs` syntax tree and sub module of root that
/// contains function pointers.
Extracts the items of the given `bindings.rs` syntax tree and sub module of root that
contains function pointers.
Extracts the items of the given ` bindings . rs ` syntax tree and sub module of root that contains function pointers .
fn filter_fn_ptr_items<'a>(
            bindings_tree: &'a syn::File,
            module_name: &str,
        ) -> Vec<&'a ForeignItemStatic> {
            let (_, root_mod_items) = match bindings_tree.items.as_slice() {
                [Item::Mod(ItemMod {
                    ident: id,
                    content: Some(c),
                    ..
                })] if id == "root" => c,
                _ => panic!("root mod not found"),
            };
            let (_, fn_ptr_mod_items) = root_mod_items
                .iter()
                .find_map(|item| match item {
                    Item::Mod(ItemMod {
                        ident: id,
                        content: Some(c),
                        ..
                    }) if id == module_name => Some(c),
                    _ => None,
                })
                .expect("function pointer mod not found");
            fn_ptr_mod_items
                .iter()
                .filter_map(|item| match item {
                    Item::ForeignMod(ItemForeignMod { items, .. }) => match items.as_slice() {
                        [ForeignItem::Static(i)] => Some(i),
                        _ => None,
                    },
                    _ => None,
                })
                .collect()
        }
fn filter_fn_ptr_items < ' a > ( bindings_tree : & ' a syn :: File , module_name : & str , ) -> Vec < & ' a ForeignItemStatic > { let ( _ , root_mod_items ) = match bindings_tree . items . as_slice ( ) { [ Item :: Mod ( ItemMod { ident : id , content : Some ( c ) , .. } ) ] if id == " " => c , _ => panic ! ( " " ) , } ; let ( _ , fn_ptr_mod_items ) = root_mod_items . iter ( ) . find_map ( | item | match item { Item :: Mod ( ItemMod { ident : id , content : Some ( c ) , .. } ) if id == module_name => Some ( c ) , _ => None , } ) . expect ( " " ) ; fn_ptr_mod_items . iter ( ) . filter_map ( | item | match item { Item :: ForeignMod ( ItemForeignMod { items , .. } ) => match items . as_slice ( ) { [ ForeignItem :: Static ( i ) ] => Some ( i ) , _ => None , } , _ => None , } ) . collect ( ) }
Extracts the items of the given `bindings.rs` syntax tree and sub module of root that
contains function pointers.
Extracts the items of the given ` bindings . rs ` syntax tree and sub module of root that contains function pointers .
bindings_tree
&'a syn::File
module_name
&str
bindings_tree
&'a syn::File
module_name
&str