fn is_whitespace(byte: u8) -> bool
Expand description
Returns true if the given byte is “whitespace” as defined by RFC 2822.
From S2.2.2:
Many of these tokens are allowed (according to their syntax) to be introduced or end with comments (as described in section 3.2.3) as well as the space (SP, ASCII value 32) and horizontal tab (HTAB, ASCII value 9) characters (together known as the white space characters, WSP), and those WSP characters are subject to header “folding” and “unfolding” as described in section 2.2.3.
In other words, ASCII space or tab.
With all that said, it seems odd to limit this to just spaces or tabs, so
we relax this and let it absorb any kind of ASCII whitespace. This also
handles, I believe, most cases of “folding” whitespace. (By treating \r
and \n
as whitespace.)