#[non_exhaustive]pub enum Identifier {
Doi(String),
Pmid(String),
Pmcid(String),
Omid(String),
Issn(String),
Isbn(String),
OpenAlex(String),
Orcid(String),
Ror(String),
Crossref(String),
Other {
scheme: String,
value: String,
},
}Expand description
One identifier of a bibliographic entity, in the scheme:value form
OpenCitations writes.
The known schemes get a variant of their own so a caller can match on them;
anything else is kept verbatim in Identifier::Other rather than being
refused, because OpenCitations adds sources over time and an id this crate
has not heard of is still an id worth passing back.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Doi(String)
a DOI, e.g. doi:10.1016/j.marpol.2021.104855
Pmid(String)
a PubMed id, e.g. pmid:22683049
Pmcid(String)
a PubMed Central id, e.g. pmcid:PMC3339580
Omid(String)
an OpenCitations Meta id, e.g. omid:br/06220256775 for a work or
omid:ra/06220760311 for an agent
Issn(String)
an ISSN, which identifies a venue rather than a work
Isbn(String)
an ISBN
OpenAlex(String)
an OpenAlex id, e.g. openalex:W3214241825
Orcid(String)
an ORCID, which identifies a person rather than a work; Meta credits authors by one where it has it
Ror(String)
a ROR id, which identifies an institution
Crossref(String)
a Crossref member id, e.g. crossref:78
Other
a scheme this crate does not know, kept as it arrived
Implementations§
Source§impl Identifier
impl Identifier
Sourcepub fn doi(doi: impl Into<String>) -> Self
pub fn doi(doi: impl Into<String>) -> Self
A DOI identifier. The doi: prefix is added, not expected.
Sourcepub fn pmid(pmid: impl Into<String>) -> Self
pub fn pmid(pmid: impl Into<String>) -> Self
A PubMed identifier. The pmid: prefix is added, not expected.
Sourcepub fn omid(omid: impl Into<String>) -> Self
pub fn omid(omid: impl Into<String>) -> Self
An OpenCitations Meta identifier. The omid: prefix is added, not
expected, so this takes the br/06220256775 half.
Sourcepub fn as_doi(&self) -> Option<&str>
pub fn as_doi(&self) -> Option<&str>
The DOI, when this is one.
The usual reason to reach into a citing or cited bag: a DOI is what
another api – crossref, a bibliography, a reference manager – can be
asked about next.
Sourcepub fn parse_bag(bag: &str) -> Result<Vec<Identifier>>
pub fn parse_bag(bag: &str) -> Result<Vec<Identifier>>
Reads the space-separated bag of identifiers OpenCitations writes into
its citing, cited and id fields.
An id in the list that cannot be read stops the whole list, because a silently shortened bag is indistinguishable from a work that is known by fewer identifiers.
Trait Implementations§
Source§impl Clone for Identifier
impl Clone for Identifier
Source§impl Debug for Identifier
impl Debug for Identifier
Source§impl<'de> Deserialize<'de> for Identifier
impl<'de> Deserialize<'de> for Identifier
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for Identifier
impl Display for Identifier
impl Eq for Identifier
Source§impl FromStr for Identifier
impl FromStr for Identifier
Source§impl Hash for Identifier
impl Hash for Identifier
Source§impl Ord for Identifier
impl Ord for Identifier
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Identifier
impl PartialEq for Identifier
Source§impl PartialOrd for Identifier
impl PartialOrd for Identifier
Source§impl Serialize for Identifier
impl Serialize for Identifier
impl StructuralPartialEq for Identifier
Auto Trait Implementations§
impl Freeze for Identifier
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnsafeUnpin for Identifier
impl UnwindSafe for Identifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.