INNER CODE UNIT · Rust

resolve_gluesql_crate

gluesql/gluesql · macros/src/lib.rs:13

fn resolve_gluesql_crate() -> Result<syn::Path, syn::Error> {
    if std::env::var("CARGO_PKG_NAME")
        .map(|name| name == "gluesql")
        .unwrap_or(false)
    {
        return Ok(syn::parse_quote!(::gluesql::core));
    }

    if let Ok(found) = crate_name("gluesql") {
        let path = match found {
            FoundCrate::Itself => syn::parse_quote!(crate::core),
            FoundCrate::Name(name) => {
                let ident = syn::Ident::new(&name, proc_macro2::Span::call_site());
                syn::parse_quote!(::#ident::core)
            }
        };

        return Ok(path);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…