Skip to main content

ParseError

Enum ParseError 

Source
#[non_exhaustive]
pub enum ParseError { NoIdentifier { entry_key: Option<String>, }, UnsupportedIdentifier { kind: &'static str, value: String, entry_key: Option<String>, }, SoftwareUrl { url: String, entry_key: Option<String>, }, InvalidRef { raw: String, entry_key: Option<String>, source: RefParseError, }, Decode { format: &'static str, message: String, }, UnsupportedFormat { format: &'static str, }, }
Expand description

Why a single bibliography entry failed to produce a Ref.

Closed-enum so the failure-class can be exposed at the docs/ERRORS.md §3 INVALID_REF surface without leaking parser internals.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NoIdentifier

The line did not contain a doi: / arxiv: / bare-DOI / bare-arXiv id — empty (after trimming) or just a comment. Plain-refs path filters these out silently; CSL-JSON path emits this when an entry has no resolvable identifier.

Fields

§entry_key: Option<String>

The source bibliography’s citation key, when known.

§

UnsupportedIdentifier

The entry DOES carry an identifier, and it is one doiget recognises and resolves only with a request: a PMID / PMCID, through the DOI PubMed lists for it (#500, crate::pubmed::resolve_entries).

Distinct from Self::NoIdentifier because the two send a reader in opposite directions. “entry has no DOI / arXiv id” is accurate about what the parser did and wrong about the entry: a PubMed-exported .bib record carrying pmid = {9659853} is not deficient, and a user who believes it is will go and edit a bibliography that was fine. The missing piece is on doiget’s side.

Surfaces as NOT_IMPLEMENTED rather than INVALID_REF: the input is valid and the support is absent, and the two carry different advice – “wait for a release” versus “correct your input” (ADR-0055).

Fields

§kind: &'static str

Human-facing name of the identifier class, e.g. "PMID".

§value: String

The identifier as written in the entry.

§entry_key: Option<String>

The source bibliography’s citation key, when known.

§

SoftwareUrl

The entry has no DOI or arXiv id but is software on GitHub: its url is a repository or release (#614). verify checks it still resolves, and doiget cite <url> renders it as @software.

Fields

§url: String

The GitHub URL as written in the entry.

§entry_key: Option<String>

The source bibliography’s citation key, when known.

§

InvalidRef

The identifier was present but Ref::parse rejected it (malformed DOI suffix, invalid arXiv id shape, etc.).

Fields

§raw: String

The raw identifier string the parser saw.

§entry_key: Option<String>

The source bibliography’s citation key, when known.

§source: RefParseError

The structured Ref::parse failure.

§

Decode

The whole input did not deserialise — CSL-JSON that is not a JSON array, top-level malformed JSON, etc. This is a whole-input failure, not a per-entry failure; callers receive it as the sole Err element of the result iterator.

Fields

§format: &'static str

Which parser branch produced the failure ("csl-json" / "bibtex").

§message: String

serde_json::Error::to_string().

§

UnsupportedFormat

Format requested or detected, but no parser for it is shipped. Retained as a forward-compatible variant for input shapes not yet implemented (e.g. a future RIS adapter); the bibtex and csl-json paths are both live today.

Fields

§format: &'static str

The format token naming the unsupported shape.

Trait Implementations§

Source§

impl Clone for ParseError

Source§

fn clone(&self) -> ParseError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ParseError

Source§

impl Error for ParseError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for ParseError

Source§

fn eq(&self, other: &ParseError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ParseError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more