pub fn write_mime_param_at(
name: &str,
value: &str,
room_first_line: usize,
out: &mut impl Sink,
) -> Result<usize, WriteError>Expand description
Writes ; name=value as write_mime_param does, where
room_first_line columns are left on the current line (78 less what the
line holds), and returns the columns left on the line the parameter ends
on, for the next call. A one-line form that does not fit in the room goes
on a new line, ;CRLF name=value, before the value is split into
sections; the ; always goes on the current line. With a
room_first_line of 78 the output is that of write_mime_param; a
larger room is read as 78, so no line passes 78 columns.
§Errors
As write_mime_param.
§Examples
use parse_net::{mail, SliceSink};
let mut buf = [0u8; 128];
let mut out = SliceSink::new(&mut buf);
// After `Content-Disposition: attachment`, 47 columns are left.
let room = mail::write_mime_param_at("filename", "quarterly report for the northern region.pdf", 47, &mut out)?;
assert_eq!(out.written(), &b";\r\n filename=\"quarterly report for the northern region.pdf\""[..]);
assert_eq!(room, 22);
let room = mail::write_mime_param_at("size", "1024", room, &mut out)?;
assert_eq!(room, 22 - 11);