pub struct ProviderCx<'a> { /* private fields */ }Expand description
The context the retrieve stage gives a citation provider together with the
requests: the built language of the registry, through which the citation
provider makes its citation entries into content of the document’s
vocabulary (parse_entry,
build_entry), and the scope under which it
reports its slow work on the progress sheet of the build
(progress).
Implementations§
Source§impl<'a> ProviderCx<'a>
impl<'a> ProviderCx<'a>
Sourcepub fn progress(&self) -> &'a Scope
pub fn progress(&self) -> &'a Scope
Returns the scope of the retrieve stage’s row on the progress sheet of
the build (StageCx::progress).
The stage declares no row of its own: a citation provider that does
slow work, such as fetching citation entries over the network, declares
its rows under this scope (Scope::child), counting the citation
keys that are slow to answer and not those it answers from a cache. It
asks cancelled between two such keys, and returns
as soon as it can when the build was cancelled: what a cancelled step
produced is discarded whole, so what it returns need not be
meaningful. In a build that reports nowhere, the scope is
Scope::none, whose methods do nothing; the provider calls them all
the same.
Sourcepub fn lang(&self) -> &'a BuiltLang
pub fn lang(&self) -> &'a BuiltLang
Returns the built language of the registry the document is processed under.
Sourcepub fn parse_entry(
&self,
source: Arc<FlmSource>,
) -> Result<CitationEntry, CitationProviderError>
pub fn parse_entry( &self, source: Arc<FlmSource>, ) -> Result<CitationEntry, CitationProviderError>
Returns the citation entry whose content is source, FLM parsed as
inline content under the registry’s language: Knuth, \emph{The Art of Computer Programming}. The source’s origin says where the text came
from, so a diagnostic about the citation entry’s content points there.
The source must be inline content: a citation entry holding a paragraph break or a block (a list, a heading) is returned, and the retrieve stage then refuses it.
The retrieve stage calls the citation providers on a worker thread (a
thread with a large enough stack; see
on_worker_thread); a citation
provider that calls this method on another thread of its own runs it on
a worker thread too, as the copy into a synthesized value requires.
§Errors
A CitationProviderError holding the message of the first Error the
parse reports (an unknown command, a brace left open), or the failure
of the parse or of the copy into a synthesized value (content nesting
too deeply).
Sourcepub fn build_entry(
&self,
pieces: &[EntryPiece],
) -> Result<CitationEntry, CitationProviderError>
pub fn build_entry( &self, pieces: &[EntryPiece], ) -> Result<CitationEntry, CitationProviderError>
Returns the citation entry made of pieces, in order: characters shown
as they are, FLM source parsed as parse_entry
parses it, and groups written as the commands of the features that own
their meaning (EntryPiece). A citation provider that holds a work’s
citation entry as structured parts (a formatter’s italic and bold runs,
a link) uses it to make content with no text to escape and nothing to
parse back.
The characters of a text part, and the groups, come from no source text: a diagnostic about them has no position.
The retrieve stage calls the citation providers on a worker thread (a
thread with a large enough stack; see
on_worker_thread); a citation
provider that calls this method on another thread of its own runs it on
a worker thread too, as the copy into a synthesized value requires.
§Errors
A CitationProviderError holding the message of the first Error a
source part’s parse reports, or the failure of a copy (content nesting
too deeply, or a group’s command that could not be looked up in the
language).
Trait Implementations§
Source§impl<'a> Clone for ProviderCx<'a>
impl<'a> Clone for ProviderCx<'a>
impl<'a> Copy for ProviderCx<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ProviderCx<'a>
impl<'a> !UnwindSafe for ProviderCx<'a>
impl<'a> Forget for ProviderCx<'a>
impl<'a> Freeze for ProviderCx<'a>
impl<'a> Move for ProviderCx<'a>
impl<'a> Send for ProviderCx<'a>
impl<'a> Sync for ProviderCx<'a>
impl<'a> Unpin for ProviderCx<'a>
impl<'a> UnsafeUnpin for ProviderCx<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more