Expand description
Go time.Duration string parsing.
A small, dependency-free primitive that parses duration strings in the exact format accepted by Go’s
time.ParseDuration. The Datadog Agent (via spf13/viper and spf13/cast) coerces
configuration values into Go durations, and several places in Saluki need to interpret those same strings,
including the runtime configuration layer and build-time config-schema codegen. This crate is the single owner of
that algorithm so it isn’t duplicated in each of those places.
Only the parsing primitive lives here. Higher-level coercion (for example, viper’s “a bare integer is nanoseconds” fallback) is intentionally left to callers.
Enums§
- Parse
Duration Error - Error returned when a duration string can’t be parsed.
Functions§
- parse_
duration - Parses a string in the exact format accepted by Go’s
time.ParseDuration, restricted to non-negative values (sincestd::time::Durationcan’t represent negatives).