pub struct CrossrefSource { /* private fields */ }Expand description
Crossref Source impl — DOI → metadata; OA URL via message.link[].
See docs/SOURCES.md §4 for the access policy (no auth, polite pool).
Implementations§
Source§impl CrossrefSource
impl CrossrefSource
Sourcepub fn new(contact_email: String) -> Self
pub fn new(contact_email: String) -> Self
Production constructor: hard-codes https://api.crossref.org as the
base URL. The contact_email value is appended to the polite-pool
User-Agent (config plumbing arrives in a later PR — see
docs/SOURCES.md §4).
Sourcepub fn with_base(base: Url, contact_email: String) -> Self
pub fn with_base(base: Url, contact_email: String) -> Self
Construct with an arbitrary base URL.
The orchestrator (doiget-cli::commands::fetch) uses this to honor
the DOIGET_CROSSREF_BASE env var, which lets integration tests point
the source at a wiremock origin without compile-time gates. Production
callers use CrossrefSource::new.
Sourcepub async fn resolve_citation(
&self,
query: &str,
rows: u8,
ctx: &FetchContext,
) -> Result<Vec<ResolvedCandidate>, FetchError>
pub async fn resolve_citation( &self, query: &str, rows: u8, ctx: &FetchContext, ) -> Result<Vec<ResolvedCandidate>, FetchError>
Resolves a free-form bibliographic citation string to ranked DOI candidates.
Trait Implementations§
Source§impl Clone for CrossrefSource
impl Clone for CrossrefSource
Source§fn clone(&self) -> CrossrefSource
fn clone(&self) -> CrossrefSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CrossrefSource
impl Debug for CrossrefSource
Source§impl Source for CrossrefSource
impl Source for CrossrefSource
Source§fn name(&self) -> &str
fn name(&self) -> &str
Stable name used in metadata (
[doiget].source) and provenance
rows. Conventional values: "crossref", "unpaywall", "arxiv",
"openalex", "semantic-scholar", "doaj", "tdm-elsevier",
etc. (see docs/SOURCES.md).Source§fn can_serve(&self, _profile: &CapabilityProfile, ref_: &Ref) -> bool
fn can_serve(&self, _profile: &CapabilityProfile, ref_: &Ref) -> bool
True if this source can plausibly serve the given ref under the
runtime capability profile. Implementations MUST be fast and
non-blocking; the orchestrator calls
can_serve to decide whether
to invoke fetch at all.Source§fn fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ref_: &'life1 Ref,
_profile: &'life2 CapabilityProfile,
ctx: &'life3 FetchContext,
) -> Pin<Box<dyn Future<Output = Result<FetchResult, FetchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ref_: &'life1 Ref,
_profile: &'life2 CapabilityProfile,
ctx: &'life3 FetchContext,
) -> Pin<Box<dyn Future<Output = Result<FetchResult, FetchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Perform the source-specific fetch. Read more
Auto Trait Implementations§
impl Freeze for CrossrefSource
impl RefUnwindSafe for CrossrefSource
impl Send for CrossrefSource
impl Sync for CrossrefSource
impl Unpin for CrossrefSource
impl UnsafeUnpin for CrossrefSource
impl UnwindSafe for CrossrefSource
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