pub fn write_mime_param(
name: &str,
value: &str,
out: &mut impl Sink,
) -> Result<(), WriteError>Expand description
Writes ; name=value: as a token, as a quoted string, or, for non-ASCII
or long values, as ; name*=UTF-8''..., split into name*0*,
name*1* sections on folded lines when one line would pass 78 columns.
The parameter starts a line of its own: use write_mime_param_at
after other text on the line. The output parses back with
parse_mime_params to the same value.
§Errors
WriteError::NotToken for a name that is not a MIME token or holds *,
', or %; WriteError::Forbidden for a control character in
value; WriteError::OutOfRange for a value needing more than 32
sections; WriteError::Full (nothing written when the sink reports its
room).
§Examples
use parse_net::{mail, SliceSink};
let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
mail::write_mime_param("filename", "caf\u{e9}.txt", &mut out)?;
assert_eq!(out.written(), b"; filename*=UTF-8''caf%C3%A9.txt");