Skip to main content

ResolvedReference

Struct ResolvedReference 

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

The 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

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ResolvedReference

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 Debug for ResolvedReference

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ResolvedReference

Source§

impl PartialEq for ResolvedReference

Source§

fn eq(&self, other: &ResolvedReference) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResolvedReference

Auto Trait Implementations§

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> 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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.