Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neoncitylights/arxiv
A Rust crate to parse arXiv identifiers and references
https://github.com/neoncitylights/arxiv
Last synced: 2 days ago
JSON representation
A Rust crate to parse arXiv identifiers and references
- Host: GitHub
- URL: https://github.com/neoncitylights/arxiv
- Owner: neoncitylights
- License: apache-2.0
- Created: 2023-03-28T00:22:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-04T10:12:53.000Z (11 days ago)
- Last Synced: 2024-11-04T11:20:57.552Z (11 days ago)
- Language: Rust
- Homepage: https://docs.rs/arxiv
- Size: 161 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# arXiv
[![License][license-badge]][license-url]
[![CI][ci-badge]][ci-url]
[![Nightly Docs][docs-nightly-badge]][docs-nightly-url]
[![Docs.rs][docs-badge]][docs-url][license-badge]: https://img.shields.io/badge/License-MIT%20%26%20Apache%202.0-blue?style=flat-square
[license-url]: #license
[ci-badge]: https://img.shields.io/github/actions/workflow/status/neoncitylights/arxiv/.github/workflows/main.yml?style=flat-square
[ci-url]: https://github.com/neoncitylights/arxiv/actions/workflows/main.yml
[docs-nightly-badge]: https://img.shields.io/github/deployments/neoncitylights/arxiv/github-pages?style=flat-square&label=nightly%20docs
[docs-nightly-url]: https://neoncitylights.github.io/arxiv/arxiv/
[docs-badge]: https://img.shields.io/docsrs/arxiv?style=flat-square&label=docs.rs
[docs-url]: https://docs.rs/arxivA Rust library for parsing `arXiv` categories, identifiers and references.
## Install
```shell
cargo add arxiv
```## Usage
## Identifiers
```rust
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
```rust
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
```rust
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.## License
Licensed under either of
* Apache License, Version 2.0 ([`LICENSE-APACHE`](LICENSE-APACHE) or )
* MIT license ([`LICENSE-MIT`](LICENSE-MIT) or )at your option.
### Contribution
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.