pub struct EdgeSpan {
pub target: String,
pub raw: String,
pub alias: Option<String>,
pub start: usize,
pub end: usize,
}Expand description
Push every [[target]] on one line into out, alias-stripped ([[a|b]] →
a), trimmed, and canonicalized. The triple-bracket flow-form mis-encoding
([[[a]], …]) is skipped, matching validate. Shared by both the frontmatter
and body scans in extract_edge_targets so they honor one link grammar.
One wiki-link OCCURRENCE in a body, with the byte span it covers.
extract_edge_targets answers “what does this file link to” — deduped,
order-insensitive, the graph’s view. This answers “where, exactly, are the
link tokens” — the view a RENDERER needs, because rewriting [[…]] into
presentation markup is a splice at a position, not a set operation.
Exposing it is what keeps the grammar in one place. A host that must render
wiki-links otherwise has to re-find the tokens itself, which means a second
implementation of [[/]]/| scanning and — the part that always rots —
a second implementation of fence tracking. (Observed in the wild: a hub
whose renderer rewrote fenced example links into live links, corrupting the
code samples on exactly the pages that documented the syntax.)
Fields§
§target: StringThe canonical target, byte-identical to the string
extract_edge_targets yields for this occurrence — so the extension
is NOT appended here (callers that want a store path add .md, exactly
as emit does).
raw: StringThe inner text verbatim (between [[ and ]]), untrimmed and unsplit,
so a host with its own conventions can reinterpret it.
alias: Option<String>The |alias label, if the occurrence carries one.
A #fragment is deliberately NOT split out: fragments are not in the
format (they ride inside the target — see canonical_link_target), so
splitting one is a host convention, not db.md grammar.
start: usizeByte offsets into the body passed in — [start, end) covers the whole
[[…]] token including both bracket pairs.
end: usizeTrait Implementations§
impl Eq for EdgeSpan
impl StructuralPartialEq for EdgeSpan
Auto Trait Implementations§
impl Freeze for EdgeSpan
impl RefUnwindSafe for EdgeSpan
impl Send for EdgeSpan
impl Sync for EdgeSpan
impl Unpin for EdgeSpan
impl UnsafeUnpin for EdgeSpan
impl UnwindSafe for EdgeSpan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.