pub struct ArxivId(/* private fields */);Expand description
A validated arXiv id string.
Construct via ArxivId::parse(s) (Phase 1+). Inner field is pub(crate).
Wire format: bare string (#[serde(transparent)]), e.g. "2401.12345".
Implementations§
Source§impl ArxivId
impl ArxivId
Sourcepub fn parse(s: &str) -> Result<Self, RefParseError>
pub fn parse(s: &str) -> Result<Self, RefParseError>
Parses and validates an arXiv id per docs/SECURITY.md §1.1 and the
pattern published in docs/MCP_TOOLS.md.
Accepts:
- New-style ids:
YYMM.NNNNN[vN]where the date block is 4 digits, the sequence number is 4–5 digits, and the optional versionvNis one or more digits. Examples:2401.12345,2401.12345v2. - Old-style ids:
subject-class/YYMMNNN[vN]where the subject class is a lowercase token (with optional internal hyphens and an optional.XXtwo-uppercase-letter group), and the numeric body is exactly 7 digits with optionalvN. Examples:cond-mat/9501001,astro-ph.CO/0703123v2. - The
arxiv:/arXiv:URI scheme prefix; it is stripped before validation.
Rejects:
- Inputs that match neither the new-style nor old-style shape.
- Inputs containing characters outside the per-shape charset (control chars, whitespace, non-ASCII).
- Empty input.
§Errors
Returns a RefParseError variant that names the specific rejection
category.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ArxivId
impl<'de> Deserialize<'de> for ArxivId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ArxivId
impl StructuralPartialEq for ArxivId
Auto Trait Implementations§
impl Freeze for ArxivId
impl RefUnwindSafe for ArxivId
impl Send for ArxivId
impl Sync for ArxivId
impl Unpin for ArxivId
impl UnsafeUnpin for ArxivId
impl UnwindSafe for ArxivId
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
Mutably borrows from an owned value. Read more