pub fn safe_wrap_internal(_attr: TokenStream, item: TokenStream) -> TokenStream {
    //  println!("attr: {:#?}", attr);
    //  println!("item: {:#?}", item);
    //  Parse the macro input as an extern "C" function declaration.
    let input = parse_macro_input!(item as ItemForeignMod);
    //  println!("input: {:#?}", input);
    //  For each `ForeignItem` function or variable declaration...
    for foreign_item in input.items {  //  `foreign_item` has type `ForeignItem`
        match foreign_item {
            ForeignItem::Fn(foreign_fn) => {
                //  Generate the safe wrapper tokens for the extern function.
                let expanded = wrap_function(&foreign_fn);
                //  Return the expanded tokens back to the compiler.
                //  println!("expanded: {:#?}", expanded);
                return TokenStream::from(expanded)  //  TODO: Handle multiple functions.
            }
            ForeignItem::Static(foreign_static) => {
                return quote! { extern "C" { #foreign_static } }.into()
            }
            _ => {
                println!("safe_wrap_internal: Unknown extern {:#?}", quote! { #foreign_item }.to_string());
                assert!(false, "Unknown extern");  //  TODO: Handle unknown extern.
            }
        }        
        break;
    }
    println!("safe_wrap_internal: Loop should not terminate");
    assert!(false, "Non-function extern");  //  TODO: Handle non-function externs.
    "// Should not come here".parse().unwrap()
}
/// Given an `extern "C"` block of function declarations, generate the safe wrapper for the function.
Given an `extern "C"` block of function declarations, generate the safe wrapper for the function.
Given an ` extern " C " ` block of function declarations generate the safe wrapper for the function .
pub fn safe_wrap_internal(_attr: TokenStream, item: TokenStream) -> TokenStream {
    //  println!("attr: {:#?}", attr);
    //  println!("item: {:#?}", item);
    //  Parse the macro input as an extern "C" function declaration.
    let input = parse_macro_input!(item as ItemForeignMod);
    //  println!("input: {:#?}", input);
    //  For each `ForeignItem` function or variable declaration...
    for foreign_item in input.items {  //  `foreign_item` has type `ForeignItem`
        match foreign_item {
            ForeignItem::Fn(foreign_fn) => {
                //  Generate the safe wrapper tokens for the extern function.
                let expanded = wrap_function(&foreign_fn);
                //  Return the expanded tokens back to the compiler.
                //  println!("expanded: {:#?}", expanded);
                return TokenStream::from(expanded)  //  TODO: Handle multiple functions.
            }
            ForeignItem::Static(foreign_static) => {
                return quote! { extern "C" { #foreign_static } }.into()
            }
            _ => {
                println!("safe_wrap_internal: Unknown extern {:#?}", quote! { #foreign_item }.to_string());
                assert!(false, "Unknown extern");  //  TODO: Handle unknown extern.
            }
        }        
        break;
    }
    println!("safe_wrap_internal: Loop should not terminate");
    assert!(false, "Non-function extern");  //  TODO: Handle non-function externs.
    "// Should not come here".parse().unwrap()
}
pub fn safe_wrap_internal ( _attr : TokenStream , item : TokenStream ) -> TokenStream { //  println!("attr: {:#?}", attr); //  println!("item: {:#?}", item); //  Parse the macro input as an extern "C" function declaration. let input = parse_macro_input ! ( item as ItemForeignMod ) ; //  println!("input: {:#?}", input); //  For each `ForeignItem` function or variable declaration... for foreign_item in input . items { //  `foreign_item` has type `ForeignItem` match foreign_item { ForeignItem :: Fn ( foreign_fn ) => { //  Generate the safe wrapper tokens for the extern function. let expanded = wrap_function ( & foreign_fn ) ; //  Return the expanded tokens back to the compiler. //  println!("expanded: {:#?}", expanded); return TokenStream :: from ( expanded ) //  TODO: Handle multiple functions. } ForeignItem :: Static ( foreign_static ) => { return quote ! { extern " " { foreign_static } } . into ( ) } _ => { println ! ( " " quote { foreign_item } to_string ( ) ) ; assert ! ( false " " ) ; //  TODO: Handle unknown extern. } } break ; } println ! ( " " ) ; assert ! ( false " " ) ; //  TODO: Handle non-function externs. " " . parse ( ) . unwrap ( ) }
Given an `extern "C"` block of function declarations, generate the safe wrapper for the function.
Given an ` extern " C " ` block of function declarations generate the safe wrapper for the function .
_attr
TokenStream
item
TokenStream
_attr
TokenStream
item
TokenStream