fn map_to_fn_ptr(item: &ForeignItemStatic) -> FnPtr {
            let option_segment = match &*item.ty {
                Type::Path(p) => p
                    .path
                    .segments
                    .iter()
                    .find(|seg| seg.ident == "Option")
                    .expect("Option not found in fn ptr item"),
                _ => panic!("fn ptr item doesn't have path type"),
            };
            let bare_fn = match &option_segment.arguments {
                PathArguments::AngleBracketed(a) => {
                    let generic_arg = a.args.first().expect("Angle bracket must have arg");
                    match generic_arg {
                        GenericArgument::Type(Type::BareFn(bare_fn)) => bare_fn,
                        _ => panic!("Generic argument is not a BareFn"),
                    }
                }
                _ => panic!("Option type doesn't have angle bracket"),
            };
            FnPtr {
                name: item.ident.clone(),
                signature: bare_fn.clone(),
            }
        }
/// Converts a syntax tree item which represents a REAPER function pointer to our
/// convenience struct `ReaperFnPtr`
Converts a syntax tree item which represents a REAPER function pointer to our
convenience struct `ReaperFnPtr`
Converts a syntax tree item which represents a REAPER function pointer to our convenience struct ` ReaperFnPtr `
fn map_to_fn_ptr(item: &ForeignItemStatic) -> FnPtr {
            let option_segment = match &*item.ty {
                Type::Path(p) => p
                    .path
                    .segments
                    .iter()
                    .find(|seg| seg.ident == "Option")
                    .expect("Option not found in fn ptr item"),
                _ => panic!("fn ptr item doesn't have path type"),
            };
            let bare_fn = match &option_segment.arguments {
                PathArguments::AngleBracketed(a) => {
                    let generic_arg = a.args.first().expect("Angle bracket must have arg");
                    match generic_arg {
                        GenericArgument::Type(Type::BareFn(bare_fn)) => bare_fn,
                        _ => panic!("Generic argument is not a BareFn"),
                    }
                }
                _ => panic!("Option type doesn't have angle bracket"),
            };
            FnPtr {
                name: item.ident.clone(),
                signature: bare_fn.clone(),
            }
        }
fn map_to_fn_ptr ( item : & ForeignItemStatic ) -> FnPtr { let option_segment = match & * item . ty { Type :: Path ( p ) => p . path . segments . iter ( ) . find ( | seg | seg . ident == " " ) . expect ( " " ) , _ => panic ! ( " " ) , } ; let bare_fn = match & option_segment . arguments { PathArguments :: AngleBracketed ( a ) => { let generic_arg = a . args . first ( ) . expect ( " " ) ; match generic_arg { GenericArgument :: Type ( Type :: BareFn ( bare_fn ) ) => bare_fn , _ => panic ! ( " " ) , } } _ => panic ! ( " " ) , } ; FnPtr { name : item . ident . clone ( ) , signature : bare_fn . clone ( ) , } }
Converts a syntax tree item which represents a REAPER function pointer to our
convenience struct `ReaperFnPtr`
Converts a syntax tree item which represents a REAPER function pointer to our convenience struct ` ReaperFnPtr `
item
&ForeignItemStatic
item
&ForeignItemStatic