Skip to main content

decode_lower_only_into

Function decode_lower_only_into 

Source
pub fn decode_lower_only_into<'b>(
    input: &[u8],
    out: &'b mut [u8],
) -> Result<&'b [u8], ParseError>
Expand description

As decode_into, refusing uppercase hex (RFC 9651 section 4.2.10).

§Errors

ErrorKind::InvalidPercentEncoding for uppercase hex or a broken triple; ErrorKind::BufferTooSmall. Nothing is written on error.

§Examples

use parse_net::pct::decode_lower_only_into;

let mut buf = [0u8; 4];
assert_eq!(decode_lower_only_into(b"%c3%a9", &mut buf)?, b"\xc3\xa9");
assert!(decode_lower_only_into(b"%C3%A9", &mut buf).is_err());