pub fn write_attachment(
filename: &str,
out: &mut impl Sink,
) -> Result<(), WriteError>Expand description
Writes attachment; filename="<ASCII fallback>", followed by
; filename*=UTF-8''<encoded> when the name is not plain printable ASCII
without " and \. The fallback replaces each such character with _.
§Errors
WriteError::Forbidden for a control character in filename;
WriteError::Full (nothing written when the sink reports its room).
§Examples
use parse_net::{write_attachment, SliceSink};
let mut buf = [0u8; 96];
let mut out = SliceSink::new(&mut buf);
write_attachment("\u{20ac} rates.txt", &mut out).expect("room");
assert_eq!(out.written(), b"attachment; filename=\"_ rates.txt\"; filename*=UTF-8''%E2%82%AC%20rates.txt");