Skip to main content

validate

Function validate 

Source
pub fn validate(input: &[u8]) -> Result<(), ParseError>
Expand description

Checks that every % is followed by two hex digits (either case).

§Errors

ErrorKind::InvalidPercentEncoding at the %.

§Examples

use parse_net::pct::validate;

assert!(validate(b"a%20b").is_ok());
assert_eq!(validate(b"a%2").unwrap_err().offset(), 1);