INNER CODE UNIT · Rust

derive_graphql_query

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

pub fn derive_graphql_query(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    match graphql_query_derive_inner(input) {
        Ok(ts) => ts,
        Err(err) => err.to_compile_error().into(),
    }
}

fn graphql_query_derive_inner(
    input: proc_macro::TokenStream,
) -> Result<proc_macro::TokenStream, syn::Error> {
    let input = TokenStream::from(input);
    let ast = syn::parse2(input)?;
    let (query_path, schema_path) = build_query_and_schema_path(&ast)?;
    let options = build_graphql_client_derive_options(&ast, query_path.clone())?;

    generate_module_token_stream(query_path, &schema_path, options)
        .map(Into::into)
        .map_err(|err| {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…