#[non_exhaustive]pub enum RefParseError {
Empty,
MissingDoiPrefix,
MissingDoiSuffixSeparator,
InvalidDoiRegistrant,
EmptyDoiSuffix,
DoiSuffixTooLong {
len: usize,
max: usize,
},
InvalidDoiSuffixChar {
ch: char,
},
InvalidArxivShape,
}Expand description
Reasons a Doi::parse / ArxivId::parse / Ref::parse call can fail.
Each variant maps to one rejection category in docs/SECURITY.md §1.1.
All variants funnel to ErrorCode::InvalidRef when surfacing to MCP /
CLI; the granular shape is preserved for tests and for future log
breadcrumbs. The From<RefParseError> for ErrorCode impl below makes
? propagation collapse to INVALID_REF automatically, satisfying
docs/PUBLIC_API.md §4.
Marked #[non_exhaustive] so adding new categories is a non-breaking
change. Pattern-match with a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
Input was empty.
MissingDoiPrefix
Input did not begin with the required 10. literal (after any
scheme strip).
MissingDoiSuffixSeparator
Input started with 10. but had no / separator between
registrant and suffix.
InvalidDoiRegistrant
Registrant was not 4–9 ASCII digits.
EmptyDoiSuffix
DOI suffix was empty.
DoiSuffixTooLong
DOI suffix exceeded DOI_SUFFIX_MAX_LEN bytes.
Fields
max: usizeHard upper bound (always DOI_SUFFIX_MAX_LEN).
InvalidDoiSuffixChar
DOI suffix contained a character outside [A-Za-z0-9._/()-].
InvalidArxivShape
Input matched neither the new-style nor old-style arXiv shape.
Trait Implementations§
Source§impl Clone for RefParseError
impl Clone for RefParseError
Source§fn clone(&self) -> RefParseError
fn clone(&self) -> RefParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RefParseError
impl Debug for RefParseError
Source§impl Display for RefParseError
impl Display for RefParseError
Source§impl Error for RefParseError
impl Error for RefParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<RefParseError> for ErrorCode
impl From<RefParseError> for ErrorCode
Source§fn from(_: RefParseError) -> Self
fn from(_: RefParseError) -> Self
Source§impl From<RefParseError> for FetchError
impl From<RefParseError> for FetchError
Source§fn from(source: RefParseError) -> Self
fn from(source: RefParseError) -> Self
Source§impl PartialEq for RefParseError
impl PartialEq for RefParseError
Source§fn eq(&self, other: &RefParseError) -> bool
fn eq(&self, other: &RefParseError) -> bool
self and other values to be equal, and is used by ==.