Function winnow::number::streaming::hex_u32

source ·
pub fn hex_u32<I, E: ParseError<I>>(input: I) -> IResult<I, u32, E>where
    I: Stream,
    <I as Stream>::Token: AsChar,
    <I as Stream>::Slice: AsBStr,
👎Deprecated since 0.1.0: Replaced with <code>winnow::character::hex_uint</code> with input wrapped in <code>winnow::Partial</code>
Expand description

Recognizes a hex-encoded integer.

Partial version: Will return Err(winnow::error::ErrMode::Incomplete(_)) if there is not enough data.

use winnow::number::streaming::hex_u32;

let parser = |s| {
  hex_u32(s)
};

assert_eq!(parser(&b"01AE;"[..]), Ok((&b";"[..], 0x01AE)));
assert_eq!(parser(&b"abc"[..]), Err(ErrMode::Incomplete(Needed::new(1))));
assert_eq!(parser(&b"ggg"[..]), Err(ErrMode::Backtrack(Error::new(&b"ggg"[..], ErrorKind::IsA))));

WARNING: Deprecated, replaced with winnow::character::hex_uint with input wrapped in winnow::Partial