Crate arxiv_tools

Crate arxiv_tools 

Source
Expand description

§Description

This library provides a simple interface to query the arXiv API.

§Example

§Simple Query

// get arxiv object from query parameters
let mut arxiv = ArXiv::from_args(QueryParams::title("attention is all you need"));

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

//verify
let paper = response.first().unwrap();
assert!(paper.title.to_lowercase().contains("attention is all you need"));

§Complex Query

// build query parameters
let args = QueryParams::and(vec![
    QueryParams::or(vec![QueryParams::title("ai"), QueryParams::title("llm")]),
    QueryParams::group(vec![QueryParams::or(vec![
        QueryParams::subject_category(Category::CsAi),
        QueryParams::subject_category(Category::CsLg),
    ])]),
    QueryParams::SubmittedDate(String::from("202412010000"), String::from("202412012359")),
]);
let mut arxiv = ArXiv::from_args(args);

// set additional parameters
arxiv.start(10);
arxiv.max_results(100);
arxiv.sort_by(SortBy::SubmittedDate);
arxiv.sort_order(SortOrder::Ascending);

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

// verify
assert!(response.len() > 0);

Structs§

ArXiv
Paper

Enums§

Category
QueryParams
SortBy
SortOrder