Crates.io | arxiv |
lib.rs | arxiv |
version | 1.0.1 |
source | src |
created_at | 2023-03-28 08:26:40.39698 |
updated_at | 2024-11-06 07:03:45.491693 |
description | Rust library to parse arXiv identifiers and references |
homepage | |
repository | https://github.com/neoncitylights/arxiv |
max_upload_size | |
id | 822847 |
size | 50,439 |
A Rust library for parsing arXiv
categories, identifiers and references.
cargo add arxiv
use arxiv::{ArticleId, ArticleVersion};
let id = ArticleId::try_from("arXiv:9912.12345v2").unwrap();
assert_eq!(id.month(), 12);
assert_eq!(id.year(), 2099);
assert_eq!(id.number(), "12345");
assert_eq!(id.version(), ArticleVersion::Num(2));
use arxiv::{Archive, CategoryId, Group};
let category = CategoryId::try_from("astro-ph.HE").unwrap();
assert_eq!(category.group(), Group::Physics);
assert_eq!(category.archive(), Archive::AstroPh);
assert_eq!(category.subject(), "HE");
use arxiv::{Archive, CategoryId, Stamp};
let stamp = Stamp::try_from("arXiv:0706.0001v1 [q-bio.CB] 1 Jun 2007").unwrap();
assert_eq!(stamp.category, CategoryId::try_new(Archive::QBio, "CB").unwrap());
assert_eq!(stamp.submitted.year(), 2007);
The crate has the following feature flags:
url
(default): Enables converting types into URLs where possible, such as converting an article identifier into a URL that leads to its abstract page.Licensed under either of
LICENSE-APACHE
or http://www.apache.org/licenses/LICENSE-2.0)LICENSE-MIT
or http://opensource.org/licenses/MIT)at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.