pub fn check_header_value(value: &[u8]) -> Result<(), ParseError>Expand description
Checks a header field value for writing: no CR, LF, or NUL, and at most
998 bytes (the physical line limit of RFC 5322 section 2.1.1, which the
caller’s Name: also counts toward).
§Errors
ErrorKind::BareCr, ErrorKind::LineFeed, ErrorKind::Nul;
ErrorKind::LineTooLong.
§Examples
use parse_net::{mail, ErrorKind};
assert!(mail::check_header_value(b"Hello there").is_ok());
assert_eq!(mail::check_header_value(b"a\r\nBcc: x").unwrap_err().kind(), ErrorKind::BareCr);
assert_eq!(mail::check_header_value(&[b'a'; 999]).unwrap_err().kind(), ErrorKind::LineTooLong);