pub fn unfold(value: &[u8]) -> Result<Unfolded<'_>, ParseError>Expand description
Validates a folded header field body and returns its pieces: the text
between CRLF WSP folds, each CRLF removed and the WSP kept (RFC 5322
section 2.2.3). Concatenated, the pieces are the unfolded value.
§Errors
ErrorKind::BareCr (a CR not followed by LF and WSP),
ErrorKind::LineFeed (an LF without CR), ErrorKind::Nul.
§Examples
use parse_net::mail;
let u = mail::unfold(b"a long\r\n subject")?;
assert_eq!(u.iter().collect::<Vec<_>>(), [&b"a long"[..], b" subject"]);
assert!(mail::unfold(b"a\r\nb").is_err());