INNER CODE UNIT · Rust

build_query_and_schema_path

graphql-rust/graphql-client · graphql_query_derive/src/lib.rs:42

fn build_query_and_schema_path(input: &syn::DeriveInput) -> Result<(PathBuf, PathBuf), syn::Error> {
    let cargo_manifest_dir = env::var("CARGO_MANIFEST_DIR").map_err(|_err| {
        syn::Error::new_spanned(
            input,
            "Error checking that the CARGO_MANIFEST_DIR env variable is defined.",
        )
    })?;

    let query_path = attributes::extract_attr(input, "query_path")?;
    let query_path = format!("{}/{}", cargo_manifest_dir, query_path);
    let query_path = Path::new(&query_path).to_path_buf();
    let schema_path = attributes::extract_attr(input, "schema_path")?;
    let schema_path = Path::new(&cargo_manifest_dir).join(schema_path);
    Ok((query_path, schema_path))
}

fn build_graphql_client_derive_options(
    input: &syn::DeriveInput,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…