#[non_exhaustive]pub struct ResolutionContext<'a> {
pub target: &'a str,
pub provided_text: Option<&'a str>,
pub derived: Option<&'a DerivedReference>,
}Expand description
Describes a single cross-reference that needs to be resolved.
This carries only information the crate itself knows about the reference. A
multi-document host that needs to know which document a reference originates
from binds that “from” context when it constructs its ReferenceResolver,
rather than receiving it here – keeping this seam free of any host-specific
coordinate system.
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.target: &'a strThe raw, uninterpreted cross-reference target, exactly as written in the
source (e.g. "section-id", a reftext, or "other-page.adoc#frag").
provided_text: Option<&'a str>Explicit link text supplied in the cross-reference, if any.
derived: Option<&'a DerivedReference>The destination the parser derived from the target itself, for a
target that names a document; None for a reference to an element
within the current document.
A resolver that can do better is free to ignore this and return its own
ResolvedReference; returning None leaves this default in place.
Implementations§
Source§impl<'a> ResolutionContext<'a>
impl<'a> ResolutionContext<'a>
Sourcepub fn new(
target: &'a str,
provided_text: Option<&'a str>,
derived: Option<&'a DerivedReference>,
) -> Self
pub fn new( target: &'a str, provided_text: Option<&'a str>, derived: Option<&'a DerivedReference>, ) -> Self
Constructs a ResolutionContext from its parts.
The crate itself builds these values internally; this constructor exists
so a downstream ReferenceResolver implementation can build its own
contexts in unit tests despite the type being #[non_exhaustive].