#[non_exhaustive]pub struct CitationAnswer {
pub entry: CitationEntry,
pub identity: Option<String>,
pub warnings: Vec<String>,
}Expand description
A citation provider’s answer for a citation key it knows: the work’s citation entry, the work’s identity, and warnings for the author.
The identity of a cited work is one spelling of its citation key that
every citation key referring to the same work shares: arxiv:1211.1037
for both arXiv:1211.1037 and arxiv:1211.1037. Citation keys answered
with the same identity are one cited work: one number, one identifier, one
entry in the list of cited works. Identities are compared as characters,
across the answers of every citation provider, so a citation provider
writes a work’s identity in the spelling that any citation provider
answering for the same work would use. Only a citation provider knows which
citation keys refer to one work: the library reads no meaning into a
citation key.
An answer that gives no identity has the citation key as written as its identity: the work is then a work of its own, unless another citation key’s answer gives that citation key as its identity.
An answer may also carry warnings: what the citation provider has to
tell the author about the citation key, for example that two citation keys
cited as two works refer to the same work. Each warning is reported as a
Warning (ProviderWarning,
flm.citations.provider-warning) at the citation key’s first citation,
with the citation provider’s text as its message; the citation entry is
shown and the numbering is unchanged.
New fields may be added; build one with CitationAnswer::new and the
builders with_identity and
with_warning.
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.entry: CitationEntryThe work’s citation entry.
identity: Option<String>The work’s identity, or None to use the citation key as written.
warnings: Vec<String>What the citation provider tells the author about the citation key, each a sentence in the citation provider’s own words, reported as a Warning at the citation key’s first citation.
Implementations§
Source§impl CitationAnswer
impl CitationAnswer
Sourcepub fn new(entry: CitationEntry) -> CitationAnswer
pub fn new(entry: CitationEntry) -> CitationAnswer
Creates the answer that shows entry, with no identity (the citation
key as written is the work’s identity) and no warning.
Sourcepub fn with_identity(self, identity: impl Into<String>) -> CitationAnswer
pub fn with_identity(self, identity: impl Into<String>) -> CitationAnswer
Builder: sets the work’s identity to identity. Every citation key
answered with the same identity refers to the same work.
Sourcepub fn with_warning(self, text: impl Into<String>) -> CitationAnswer
pub fn with_warning(self, text: impl Into<String>) -> CitationAnswer
Builder: adds the warning text, a sentence stating what the author
should know about the citation key, reported as a Warning at the
citation key’s first citation. Warnings are reported in the order they
were added.
Sourcepub fn identity_for<'a>(&'a self, key: &'a str) -> &'a str
pub fn identity_for<'a>(&'a self, key: &'a str) -> &'a str
Returns the identity of the work this answer gives for key: its
identity where it has one, else key itself.
Trait Implementations§
Source§impl Clone for CitationAnswer
impl Clone for CitationAnswer
Auto Trait Implementations§
impl !RefUnwindSafe for CitationAnswer
impl !UnwindSafe for CitationAnswer
impl Forget for CitationAnswer
impl Freeze for CitationAnswer
impl Move for CitationAnswer
impl Send for CitationAnswer
impl Sync for CitationAnswer
impl Unpin for CitationAnswer
impl UnsafeUnpin for CitationAnswerwhere
*const ArcInner<NodeTree<Flm>> is !null: UnsafeUnpin,
PhantomData<ArcInner<NodeTree<Flm>>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
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