pub struct ResolvedReference {
pub href: String,
pub text: Option<String>,
pub signifier: Option<XrefSignifier>,
}Expand description
The resolved destination of a cross-reference.
Fields§
§href: StringThe hyperlink destination. For a same-document reference this is a
fragment such as #section-id; a cross-document resolver may return a
full or relative URL.
text: Option<String>The display text to use when the cross-reference did not specify its own text. This is typically the target’s reference text (reftext).
signifier: Option<XrefSignifier>The target’s signifier and number, when it carries one and has no
explicit reftext. Present only for targets eligible for full/short
xrefstyle formatting (numbered sections and captioned
blocks); None otherwise. Ignored unless the reference selects a style.
Implementations§
Source§impl ResolvedReference
impl ResolvedReference
Sourcepub fn new(href: String, text: Option<String>) -> Self
pub fn new(href: String, text: Option<String>) -> Self
Constructs a resolved reference with no signifier.
Use this when the target is not a numbered/captioned element, or when
the resolver builds the display text from scratch. When the target
came from a Catalog (the usual case, including cross-document
resolution), prefer from_entry so
full/short xrefstyle formatting keeps working; or attach a
signifier explicitly with with_signifier.
Sourcepub fn from_entry(href: String, entry: &RefEntry) -> Self
pub fn from_entry(href: String, entry: &RefEntry) -> Self
Constructs a resolved reference to a catalog element at href, carrying
the element’s reference text and its
signifier.
This is the seam that makes full/short xrefstyle formatting work
across documents: a multi-document (Antora-style) resolver that has
located the target’s RefEntry in some document’s Catalog passes
the href it computed for that document, and the target’s signifier and
number — computed while that document was parsed — ride along. The
style itself comes from the referencing document and is applied later,
so the resolver need not know it. The single-document
CatalogResolver is built on this same helper.
Sourcepub fn with_signifier(self, signifier: XrefSignifier) -> Self
pub fn with_signifier(self, signifier: XrefSignifier) -> Self
Attaches a signifier, returning self for
chaining.
For a host resolver that builds its href/text from scratch but still
wants full/short xrefstyle formatting for a numbered or captioned
target.
Trait Implementations§
Source§impl Clone for ResolvedReference
impl Clone for ResolvedReference
Source§fn clone(&self) -> ResolvedReference
fn clone(&self) -> ResolvedReference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more