arxiv-tools 1.0.0

Tools for arXiv API.
Documentation

Crates.io Version

arxiv-tools

Tools for arXiv API.

Quick Start

Installation

To start using arxiv-tools, just add it to your project's dependencies in the Cargo.toml.

> cargo add arxiv-tools

Then, import it in your program.

use arxiv_tools::ArXiv;

Usage

arxiv-tools is a simple api wrapper. You just need to build and execute the query.

simple query

// build the query
let mut arxiv = ArXiv::from_args(ArXivArgs::title("attention is all you need"));
let response = arxiv.query().await;

// execute
let response: Vec<ArXivResponse> = arxiv.query().await;

// serialize into json
let response = serde_json::to_string_pretty(&response).unwrap();

query combining multiple conditions

// build the query
let args = ArXivArgs::and(vec![
    ArXivArgs::subject_category(ArXivCategory::CsAi),
    ArXivArgs::subject_category(ArXivCategory::CsLg),
]);
let mut arxiv = ArXiv::from_args(args);
arxiv.submitted_date("202412010000", "202412012359");

// execute
let response = arxiv.query().await;

// serialize into json
let response = serde_json::to_string_pretty(&response).unwrap();

complex query using grouped conditions

// build the query
let args = ArXivArgs::and(vec![
    ArXivArgs::or(vec![ArXivArgs::title("ai"), ArXivArgs::title("llm")]),
    ArXivArgs::group(vec![ArXivArgs::or(vec![
        ArXivArgs::subject_category(ArXivCategory::CsAi),
        ArXivArgs::subject_category(ArXivCategory::CsLg),
    ])]),
]);
let mut arxiv = ArXiv::from_args(args);
arxiv.submitted_date("202412010000", "202412012359");

// execute
let response = arxiv.query().await;

// serialize into json
let response = serde_json::to_string_pretty(&response).unwrap();