Function parse_hyperlinks::parser::asciidoc::adoc_label2dest
source · pub fn adoc_label2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>Expand description
Parses an Asciidoc link reference definition.
This parser expects to start at the first letter of :,
, or \t to succeed.
The caller must guarantee, that:
- the parser is at the beginning of the input or
- the preceding byte is a newline
\n.
link_label is always of type Cow::Borrowed(&str).
link_title is always the empty Cow::Borrowed("").
use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::asciidoc::adoc_label2dest;
use std::borrow::Cow;
assert_eq!(
adoc_label2dest(":label: https://destination\nabc"),
Ok(("\nabc", (Cow::from("label"), Cow::from("https://destination"), Cow::from(""))))
);