pub fn parse_express_id(digits: &[u8]) -> Option<u32>Expand description
Parse digits — an already-validated, non-empty run of ASCII digit bytes
— into a u32 express id, or None if the value does not fit.
Two loops rather than one: a run of at most 9 digits is at most
999_999_999 and cannot overflow u32, so the common case (every real
exporter’s ids) keeps the unchecked instruction sequence. Only a 10+
digit run — which no real exporter emits — pays for checked_mul /
checked_add.
Callers are expected to have already located the digit run (e.g. by
scanning forward while is_ascii_digit() holds); this function does not
search for one and returns Some(0) for an all-zero run rather than
treating it as absent — callers that treat id 0 as “no reference” must
check that themselves, the same way they did before this helper existed.