Skip to main content

Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }

Implementations§

Source§

impl Engine

Source

pub async fn abstracts(&self, works: &[&SourceRecord]) -> AbstractsReport

The abstract for each work: its own record’s if present, otherwise the first other provider’s (by priority) that has one. Works are identified by their records’ identifiers; pass a record with merged identifiers to widen the search.

Source§

impl Engine

Source

pub async fn check( &self, claims: &[Claim], limit: u32, progress: impl FnMut(usize), ) -> Vec<Checked>

Verifies every claim and derives findings, including duplicates across claims. progress is called with each claim’s index as it completes.

Source§

impl Engine

Source

pub async fn resolve(&self, claim: &Claim, limit: u32) -> ResolveReport

Gathers and scores every candidate for claim. limit caps results per provider search.

Source

pub async fn verify(&self, claim: &Claim, limit: u32) -> Verification

Decides whether claim refers to a real work, stopping early once it does.

Source

pub fn verify_many<'a>( &'a self, claims: &'a [Claim], limit: u32, ) -> impl Stream<Item = Verification> + 'a

Verifies many claims, several at a time (each provider’s pacing still applies), yielding results in claim order as they complete.

Source

pub async fn prefetch(&self, claims: &[Claim]) -> LookupReport

Looks up every identifier the claims assert, in one batched call per provider. With a cache attached, this warms it so verifying the claims one by one (and streaming results) doesn’t look them up one by one.

Source§

impl Engine

Source

pub async fn latest_versions(&self, works: &[&SourceRecord]) -> VersionsReport

The latest version of each work its record says is superseded (Work::newer_version), asking the providers that report notices. One batched lookup per step along the chains.

Source§

impl Engine

Source

pub fn builder() -> EngineBuilder

Source

pub fn providers(&self) -> impl Iterator<Item = &Arc<dyn Provider>>

Registered providers, in priority order.

Source

pub async fn lookup(&self, ids: &[WorkId], fields: FieldSet) -> LookupReport

Looks up every ID, falling through providers by priority. Never fails as a whole: per-ID outcomes are in the report.

Source

pub async fn add_notices(&self, report: &mut LookupReport)

Adds editorial notices, in both directions, to records that another provider supplied, from the providers that report them in detail (Crossref): an original then lists its corrections and retractions, a correction the work it corrects. Batched and cached, like lookups.

Source

pub async fn add_open_access(&self, report: &mut LookupReport)

Fills in where works can be read free, for records whose provider didn’t say, from the first provider (by priority) that does.

Source

pub async fn search( &self, source: Option<&str>, query: &SearchQuery, ) -> Result<SearchReport, EngineError>

Searches one provider: source if given, otherwise the first that supports the query’s mode.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Engine

§

impl !UnwindSafe for Engine

§

impl Forget for Engine

§

impl Freeze for Engine

§

impl Send for Engine

§

impl Sync for Engine

§

impl Unpin for Engine

§

impl UnsafeUnpin for Engine

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

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
Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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