pub fn parse_link<'a>(
value: &'a [u8],
limits: &Limits,
) -> Result<Links<'a>, ParseError>Expand description
Parses a Link field value.
§Errors
ErrorKind::InvalidByte (a target byte outside RFC 3986, a space in the
target, a member that does not start with <);
ErrorKind::UnterminatedQuote (no closing > or ");
ErrorKind::InvalidPercentEncoding; ErrorKind::NotToken and
ErrorKind::MissingValue for a parameter; the ExtValue::parse
errors for title*; ErrorKind::TooManyMembers beyond
max_list_members links or max_params parameters;
ErrorKind::TooManyEmptyElements; ErrorKind::TrailingData.
§Examples
use parse_net::{parse_link, ErrorKind, Limits};
let l = parse_link(b"<a>; rel=next; rel=prev", &Limits::DEFAULT)?;
assert!(l.iter().next().is_some_and(|v| v.has_rel("next") && !v.has_rel("prev")));
assert_eq!(parse_link(b"<a b>", &Limits::DEFAULT).unwrap_err().kind(), ErrorKind::InvalidByte);