pub fn write_link(
target: &[u8],
params: &[(&str, &str)],
out: &mut impl Sink,
) -> Result<(), WriteError>Expand description
Writes one link value: <target>; name=value for each parameter, values
through write_word. An empty value writes
the name alone (; crossorigin), which parses back as a parameter with no
value.
§Errors
WriteError::Forbidden for a target byte that is not an RFC 3986
character (<, >, SP, a control, a non-ASCII byte) or a % not
followed by two hex digits, and for a control byte in a value;
WriteError::NotToken for a name; WriteError::Full (nothing written
when the sink reports its room).
§Examples
use parse_net::{link, SliceSink};
let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
link::write_link(b"/page/2", &[("rel", "next"), ("title", "Page 2"), ("crossorigin", "")], &mut out)?;
assert_eq!(out.written(), b"</page/2>; rel=next; title=\"Page 2\"; crossorigin");