pub fn write(
type_: &str,
subtype: &str,
params: &[(&str, &str)],
out: &mut impl Sink,
) -> Result<(), WriteError>Expand description
Writes type/subtype and then ; name=value for each pair, values as a
token when they are one and as a quoted string otherwise.
§Errors
WriteError::NotToken for a type, subtype, or name that is not a token
(or is *); WriteError::Forbidden for a control byte in a value;
WriteError::Full. Nothing is written on error when the sink reports
its room.
§Examples
use parse_net::{media, SliceSink};
let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
media::write("multipart", "form-data", &[("boundary", "a b")], &mut out)?;
assert_eq!(out.written(), b"multipart/form-data; boundary=\"a b\"");