MCPcopy Create free account
hub / github.com/apache/arrow-rs / parse_nanos

Function parse_nanos

arrow-cast/src/parse.rs:32–37  ·  view source on GitHub ↗
(digits: &[u8])

Source from the content-addressed store, hash-verified

30/// Parse nanoseconds from the first `N` values in digits, subtracting the offset `O`
31#[inline]
32fn parse_nanos<const N: usize, const O: u8>(digits: &[u8]) -> u32 {
33 digits[..N]
34 .iter()
35 .fold(0_u32, |acc, v| acc * 10 + v.wrapping_sub(O) as u32)
36 * 10_u32.pow((9 - N) as _)
37}
38
39/// Helper for parsing RFC3339 timestamps
40struct TimestampParser {

Callers

nothing calls this directly

Calls 2

iterMethod · 0.45
wrapping_subMethod · 0.45

Tested by

no test coverage detected