PersistentIdentifier

Trait PersistentIdentifier 

Source
pub trait PersistentIdentifier: Display {
    // Required methods
    fn new() -> Self;
    fn schema_uri(&self) -> String;
    fn identifier(&self) -> String;

    // Provided methods
    fn prefix(&self) -> Option<String> { ... }
    fn suffix(&self) -> Option<String> { ... }
    fn check_digit(&self) -> Option<char> { ... }
    fn format(&self) -> String { ... }
    fn is_valid(&self) -> bool { ... }
}
Expand description

Provides common functions for working with persistent identifiers (PID)

Required Methods§

Source

fn new() -> Self

Create a new PID

Source

fn schema_uri(&self) -> String

Get standardized form of schema URI for a PID

§Examples
  • https://doi.org
  • https://orcid.org
Source

fn identifier(&self) -> String

Get PID identifier section

§Examples
  • ark:1234/x5678 for ARK
  • 10.1234/5678 for DOI
  • 0000-0002-2057-9115 for ORCID

Provided Methods§

Source

fn prefix(&self) -> Option<String>

Get PID prefix (different interpretation depending on PID type)

Not every PID type has a prefix, but generally every PID has a “first” part that can losely be considered a “prefix”

Source

fn suffix(&self) -> Option<String>

Get PID suffix (different interpretation depending on PID type)

Not every PID type has a suffix, but generally every PID has a “second” part that can losely be considered a “suffix”

Source

fn check_digit(&self) -> Option<char>

Get PID check digit (when applicable)

Source

fn format(&self) -> String

Convert self into a string with a standard format

Source

fn is_valid(&self) -> bool

Check if PID is valid

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§