Expand description
Link (RFC 8288 section 3): #link-value, where
link-value = "<" URI-Reference ">" *( OWS ";" OWS link-param ) and
link-param = token BWS [ "=" BWS ( token / quoted-string ) ].
The target is validated as RFC 3986 characters with well-formed %XX
triples and returned unresolved (url-lib resolves). Commas inside <...>
do not split. A title* is decoded at parse time, as filename* is, so a
view never holds an undecodable title.
§Examples
use parse_net::{parse_link, Limits};
let links = parse_link(b"<https://x.test/p?page=2,3>; rel=\"next last\", </a>; rel=prev; crossorigin", &Limits::DEFAULT)?;
let all: Vec<_> = links.iter().collect();
assert_eq!(all[0].target(), b"https://x.test/p?page=2,3");
assert!(all[0].has_rel("last") && all[1].has_rel("prev"));Structs§
- Hreflang
Iter - The
hreflangvalues of a link value. - Link
Iter - The link values of a validated
Links. - Link
Param Iter - The parameters of a validated
LinkParams. - Link
Params - The parameters of a link value.
- Link
Value - One link value: a target and its parameters.
- Links
- A validated
Linkvalue. - RelIter
- The relation types of a
relvalue.
Functions§
- parse_
link - Parses a
Linkfield value. - write_
link - Writes one link value:
<target>; name=valuefor each parameter, values throughwrite_word. An empty value writes the name alone (; crossorigin), which parses back as a parameter with no value.