MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / next_hex

Function next_hex

src/testdrive/src/format/bytes.rs:35–45  ·  view source on GitHub ↗

Retrieves the value of the next hexadecimal digit in `iter`, if the next byte is a valid hexadecimal digit.

(iter: &mut I)

Source from the content-addressed store, hash-verified

33/// Retrieves the value of the next hexadecimal digit in `iter`, if the next
34/// byte is a valid hexadecimal digit.
35fn next_hex<I>(iter: &mut I) -> Option<u8>
36where
37 I: Iterator<Item = u8>,
38{
39 iter.next().and_then(|c| match c {
40 b'A'..=b'F' => Some(c - b'A' + 10),
41 b'a'..=b'f' => Some(c - b'a' + 10),
42 b'0'..=b'9' => Some(c - b'0'),
43 _ => None,
44 })
45}

Callers 1

unescapeFunction · 0.85

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected