pub struct ExtValue<'a> { /* private fields */ }Expand description
A validated extended value.
Implementations§
Source§impl<'a> ExtValue<'a>
impl<'a> ExtValue<'a>
Sourcepub fn parse(value: &'a [u8]) -> Result<Self, ParseError>
pub fn parse(value: &'a [u8]) -> Result<Self, ParseError>
Parses an extended value.
The charset is UTF-8 or ISO-8859-1 (case-insensitive); the
language is empty or letters, digits, and -; the value is
attr-char bytes and %XX triples.
§Errors
ErrorKind::InvalidCharset (no ', an empty or malformed charset,
a malformed language); ErrorKind::UnsupportedCharset;
ErrorKind::InvalidPercentEncoding; ErrorKind::InvalidByte, or a
control kind, for a byte outside the value grammar.
Sourcepub fn max_decoded_len(&self) -> usize
pub fn max_decoded_len(&self) -> usize
An upper bound on the length decode_into
writes: exact for UTF-8, doubled for ISO-8859-1.
Sourcepub fn decode_into<'b>(&self, out: &'b mut [u8]) -> Result<&'b str, ParseError>
pub fn decode_into<'b>(&self, out: &'b mut [u8]) -> Result<&'b str, ParseError>
Decodes into out and returns the text: UTF-8 is validated
(overlong forms and surrogates refused), ISO-8859-1 is transcoded.
A decoded control character (C0, DEL, or C1, such as %0D%0A or
%00) is refused: never copy such a value into another header or a
log.
§Errors
ErrorKind::InvalidUtf8, ErrorKind::ControlInDecoded,
ErrorKind::BufferTooSmall. Nothing is written on error.