Skip to main content

ProviderCx

Struct ProviderCx 

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

Source

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.

Source

pub fn lang(&self) -> &'a BuiltLang

Returns the built language of the registry the document is processed under.

Source

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).

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ProviderCx<'a>

Source§

impl<'a> Debug for ProviderCx<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.