pub trait PersistentIdentifierConvert<T: AsRef<str>> {
// Required methods
fn format_as(&self, pid_type: PID) -> String;
fn to_pid(&self, pid_type: PID) -> PersistentIdentifierInternal;
fn is_pid(&self, _pid_type: PID) -> bool;
fn is_ark(&self) -> bool;
fn is_doi(&self) -> bool;
fn is_orcid(&self) -> bool;
fn is_raid(&self) -> bool;
fn is_ror(&self) -> bool;
// Provided method
fn is_isbn(&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::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::schema::pid::{PID, PersistentIdentifier};
let doi = "https://doi.org/10.1234/5678".to_pid(PID::DOI).to_doi();
assert_eq!(doi.suffix(), "5678");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::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::schema::pid::{PID, PersistentIdentifier};
assert!("https://n2t.net/ark:12148/btv1b8449691v/f29".is_ark());Sourcefn is_doi(&self) -> bool
fn is_doi(&self) -> bool
Determines if self is a DOI
use acorn::schema::pid::{PID, PersistentIdentifier};
assert!("https://doi.org/10.1234/5678".is_doi());Sourcefn is_orcid(&self) -> bool
fn is_orcid(&self) -> bool
Determines if self is a ORCID
ⓘ
use acorn::schema::pid::{PID, PersistentIdentifier};
assert!("https://orcid.org/0000-0000-0000-0000".is_orcid());Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".