#[non_exhaustive]pub struct MetadataOnlyOptions {
pub include_oa_location: bool,
}Expand description
What a metadata-only resolve may spend beyond its single round-trip.
One knob, and it exists because #517 removed the reason there was none.
The DOI path is Crossref-first, and its rationale was that Crossref’s
message.link[] supplied an OA URL for free. Measurement showed every
entry is programme-scoped, so extract_crossref_publisher_url
correctly returns None for every DOI – leaving oa_url permanently
null while docs/MCP_TOOLS.md s11 told callers to act on it (#539).
Crossref-first is still the right default: it resolves nearly every DOI in one request. What was wrong was promising a field it cannot fill. So the caller says whether it wants the second request.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.include_oa_location: boolConsult Unpaywall for a real OA location, filling oa_url,
oa_status and license from its record.
Costs one extra request against Unpaywall. Unpaywall is a metadata source, so this does not weaken the “never fetches a PDF, never touches a publisher” guarantee: the URL is still reported and never followed.
Off by default. A caller that wants metadata should not pay for a location it will not use.
§Reading the result
With this set, the oa_status/oa_url pair says which of three
things happened:
oa_status | oa_url | meaning |
|---|---|---|
"closed" | None | asked; this work has no OA location |
"gold", "green", … | Some | asked; here it is |
None | None | the lookup did not complete |
The third row is why a failed Unpaywall call leaves both fields
None rather than filling in a plausible-looking oa_status: a
caller that paid for a lookup has to be able to tell “no OA location
exists” from “I could not find out”, and that distinction is the
whole of #539.
Implementations§
Source§impl MetadataOnlyOptions
impl MetadataOnlyOptions
Sourcepub const fn with_oa_location(self, include: bool) -> Self
pub const fn with_oa_location(self, include: bool) -> Self
Ask for the OA location (or not).
A builder rather than a struct literal because the struct is
#[non_exhaustive]: a future option must not be a breaking change
for doiget-mcp, doiget-cli, or anyone else downstream.
Trait Implementations§
Source§impl Clone for MetadataOnlyOptions
impl Clone for MetadataOnlyOptions
Source§fn clone(&self) -> MetadataOnlyOptions
fn clone(&self) -> MetadataOnlyOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MetadataOnlyOptions
Source§impl Debug for MetadataOnlyOptions
impl Debug for MetadataOnlyOptions
Source§impl Default for MetadataOnlyOptions
impl Default for MetadataOnlyOptions
Source§fn default() -> MetadataOnlyOptions
fn default() -> MetadataOnlyOptions
impl Eq for MetadataOnlyOptions
Source§impl PartialEq for MetadataOnlyOptions
impl PartialEq for MetadataOnlyOptions
Source§fn eq(&self, other: &MetadataOnlyOptions) -> bool
fn eq(&self, other: &MetadataOnlyOptions) -> bool
self and other values to be equal, and is used by ==.