Expand description
A Rust library for parsing arXiv
categories, identifiers and references.
§Identifiers
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));
§Categories
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");
§Stamps
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);
§Feature flags
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.
Structs§
- Article
Id - A unique identifier for articles published on arXiv.org
- Category
Id - An identifier for arXiv categories, which are composed of an archive and category
- Stamp
- A stamp that is added onto the side of PDF version of arXiv articles
Enums§
- Archive
- A collection of publications that relate under the same field of study
- Article
IdError - An error that can occur when parsing and validating arXiv identifiers
- Article
IdScheme - Represents the versioned grammar that defines an arXiv identifier
- Article
Version - The version of an article as declared in an arXiv identifier
- Category
IdError - An error that can occur when parsing and validating arXiv category identifiers
- Group
- A type of classification for arXiv publications
- Stamp
Error - An error that can occur when parsing and validating arXiv stamps
Type Aliases§
- Article
IdResult - Convenient type alias for a
Result
holding either anArticleId
orArticleIdError
- Category
IdResult Result
type alias holding either aCategoryId
orCategoryIdError
- Stamp
Result - Convenient type alias for a
Result
holding either aStamp
orStampError