pub trait PersistentIdentifierConvert<T: AsRef<str>> {
    // Required methods
    fn format_as(&self, pid_type: PID) -> String;
    fn to_pid(&self, pid_type: PID) -> PersistentIdentifierInternal;
    // Provided methods
    fn is_pid(&self, _pid_type: PID) -> bool { ... }
    fn is_ark(&self) -> bool { ... }
    fn is_doi(&self) -> bool { ... }
    fn is_orcid(&self) -> bool { ... }
}Expand description
Add coercion to persistent identifier (PID) functionality to string values
Required Methods§
Sourcefn format_as(&self, pid_type: PID) -> String
 
fn format_as(&self, pid_type: PID) -> String
Convert self into a string standard format PID of a certain type
use acorn_lib::schema::pid::{PID, PersistentIdentifier};
assert_eq!("https://doi.org/10.1234/5678".format_as(PID::DOI), "10.1234/5678");
assert_eq!("0000-0002-2057-9115".format_as(PID::ORCID), "https://orcid.org/0000-0002-2057-9115");Sourcefn to_pid(&self, pid_type: PID) -> PersistentIdentifierInternal
 
fn to_pid(&self, pid_type: PID) -> PersistentIdentifierInternal
Coerce self into given PID type.
use acorn_lib::schema::pid::{PID, PersistentIdentifier};
let doi = "https://doi.org/10.1234/5678".to_pid(PID::DOI).to_doi();
assert_eq!(doi.suffix(), "5678");Provided Methods§
Sourcefn is_pid(&self, _pid_type: PID) -> bool
 
fn is_pid(&self, _pid_type: PID) -> bool
Determines if self is of the given PID type.
use acorn_lib::schema::pid::{PID, PersistentIdentifier};
assert!("https://doi.org/10.1234/5678".is_pid(PID::DOI));Sourcefn is_ark(&self) -> bool
 
fn is_ark(&self) -> bool
Determines if self is an archival resource key (ARK)
use acorn_lib::schema::pid::{PID, PersistentIdentifier};
assert!("https://n2t.net/ark:12148/btv1b8449691v/f29".is_ark());