doi 0.3.0

Digital Object Identifier (DOI) resolver
Documentation
  • Coverage
  • 31.94%
    23 out of 72 items documented10 out of 15 items with examples
  • Size
  • Source code size: 46.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.22 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 30s Average build duration of successful builds.
  • all releases: 30s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Teddy-van-Jerry/doi-rs
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Teddy-van-Jerry

DOI for Rust

Digital Object Identifier (DOI) resolver for Rust

This crate provides a simple way to resolve DOIs and retrieve metadata using the DOI APIs.

Basic Usage

The following is a basic example of using this library:

use doi::Doi;
let doi = Doi::new("10.1109/TCSII.2024.3366282");
match doi.resolve() {
    Ok(resolved) => println!("Resolved Link: {}", resolved),
    Err(e) => eprintln!("Error: {}", e),
}

Please refer to the API documentation for more information. More complicated constructions can be done using the DoiBuilder struct.

Metadata

This library also provides a way to retrieve metadata for a DOI. The metadata feature is required to use this functionality (enabled by default).

use doi::Doi;
let doi = Doi::new("10.1109/TCSII.2024.3366282");
match doi.metadata() {
    Ok(metadata) => println!("Paper Title: {}", metadata.title.unwrap_or("<unknown>".to_string())),
    Err(e) => eprintln!("Error: {}", e),
}

The raw JSON metadata can be retrieved using the metadata_json method, powered by serde_json.

use doi::Doi;
let doi = Doi::new("10.1109/TCSII.2024.3366282");
match doi.metadata_json() {
    Ok(metadata) => println!("Metadata: {}", metadata),
    Err(e) => eprintln!("Error: {}", e),
}

Blocking Requests

This library is designed to use blocking I/O, depending on the ureq library for HTTP requests.

License

This project is licensed under the MIT license.