pub fn make_include(&self, fname: String) -> TokenStream {
        match self {
            FileLocationStrategy::FromAutocxxRs(custom_dir) => {
                let fname = custom_dir.join(fname).to_str().unwrap().to_string();
                quote! {
                    include!( #fname );
                }
            }
            FileLocationStrategy::Custom(_) => panic!("Should never happen in the macro"),
            FileLocationStrategy::UnknownMaybeFromOutdir | FileLocationStrategy::FromOutDir(_) => {
                let fname = format!("/{}/{}/{}", BUILD_DIR_NAME, RS_DIR_NAME, fname);
                // rust-analyzer works better if we ask Rust to do the path
                // concatenation rather than doing it in proc-macro code.
                // proc-macro code does not itself have access to the value of
                // OUT_DIR, but if we put it into a macro like the below,
                // rust-analyzer can cope.
                quote! {
                    include!(concat!(env!("OUT_DIR"), #fname));
                }
            }
        }
    }
/// Make a macro to include a given generated Rust file name.
/// This can't simply be calculated from `get_rs_dir` because
/// of limitations in rust-analyzer.
Make a macro to include a given generated Rust file name.
This can't simply be calculated from `get_rs_dir` because
of limitations in rust-analyzer.
Make a macro to include a given generated Rust file name . This can ' t simply be calculated from ` get_rs_dir ` because of limitations in rust - analyzer .
pub fn make_include(&self, fname: String) -> TokenStream {
        match self {
            FileLocationStrategy::FromAutocxxRs(custom_dir) => {
                let fname = custom_dir.join(fname).to_str().unwrap().to_string();
                quote! {
                    include!( #fname );
                }
            }
            FileLocationStrategy::Custom(_) => panic!("Should never happen in the macro"),
            FileLocationStrategy::UnknownMaybeFromOutdir | FileLocationStrategy::FromOutDir(_) => {
                let fname = format!("/{}/{}/{}", BUILD_DIR_NAME, RS_DIR_NAME, fname);
                // rust-analyzer works better if we ask Rust to do the path
                // concatenation rather than doing it in proc-macro code.
                // proc-macro code does not itself have access to the value of
                // OUT_DIR, but if we put it into a macro like the below,
                // rust-analyzer can cope.
                quote! {
                    include!(concat!(env!("OUT_DIR"), #fname));
                }
            }
        }
    }
pub fn make_include ( & self , fname : String ) -> TokenStream { match self { FileLocationStrategy :: FromAutocxxRs ( custom_dir ) => { let fname = custom_dir . join ( fname ) . to_str ( ) . unwrap ( ) . to_string ( ) ; quote ! { include ( fname ) } } FileLocationStrategy :: Custom ( _ ) => panic ! ( " " ) , FileLocationStrategy :: UnknownMaybeFromOutdir | FileLocationStrategy :: FromOutDir ( _ ) => { let fname = format ! ( " " BUILD_DIR_NAME RS_DIR_NAME fname ) ; // rust-analyzer works better if we ask Rust to do the path // concatenation rather than doing it in proc-macro code. // proc-macro code does not itself have access to the value of // OUT_DIR, but if we put it into a macro like the below, // rust-analyzer can cope. quote ! { include ( concat ( env ( " " ) fname ) ) } } } }
Make a macro to include a given generated Rust file name.
Make a macro to include a given generated Rust file name .
&self
fname
String
&self
fname
String