pub enum LinkKind {
Wiki,
Inline,
Image,
}Expand description
Which Markdown syntax a MarkdownLink was written in.
Both are links in this project’s dialect and both are read by one scanner, which is the point: “find a Markdown link” had five implementations sharing no code, and the kinds were never all found by the same one.
§Deliberately closed, and not #[non_exhaustive]
CommonMark has link forms this does not read — reference links ([a][b])
and autolinks (<https://…>) — so a fourth variant is imaginable, which is
exactly why the set is shut rather than left open. A caller decides what
to do per kind: crate::markdown_links’ own callers rewrite an inline
link’s text over the whole link and resolve a wiki-link’s target against a
node key, and there is no behaviour that is right for a kind nobody has seen.
Left open, every one of them grows a wildcard arm and a new kind is silently
handled as whichever of these it is least like. Shut, adding one is a major
version and a compile error at each place that has to decide — which is the
cost that should be paid, and the same argument rto_faithful::Segment makes
for the same reason.
Variants§
Wiki
A Roteiro [[target]] wiki-link — the authored layer’s citation into the
graph, resolved by rto_spec against a node key.
Inline
A CommonMark [text](destination) inline link.
Image
A CommonMark  image.
Reported rather than skipped, and distinct from Self::Inline so
that it can be: a citation list filters to Inline and a .png never
reaches it, while a caller reducing markdown to its visible text — the
rustdoc-anchor guard does — keeps the alt text and drops the source. Read
as one kind and either of those is wrong.
Trait Implementations§
impl Copy for LinkKind
impl Eq for LinkKind
Source§impl Ord for LinkKind
impl Ord for LinkKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for LinkKind
impl PartialOrd for LinkKind
impl StructuralPartialEq for LinkKind
Auto Trait Implementations§
impl Freeze for LinkKind
impl RefUnwindSafe for LinkKind
impl Send for LinkKind
impl Sync for LinkKind
impl Unpin for LinkKind
impl UnsafeUnpin for LinkKind
impl UnwindSafe for LinkKind
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> Comparable<K> for Q
impl<Q, K> Comparable<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.