Skip to main content

Module timeout

Module timeout 

Source
Expand description

grpc-timeout header codec.

The wire format is <positive_integer><unit> where unit is one of H, M, S, m, u, n (hour, minute, second, millisecond, microsecond, nanosecond). The integer is at most 8 ASCII digits.

When formatting a Duration we pick the smallest unit that fits in 8 digits and round up, so the wire value is always ≥ the requested duration — we never advertise a tighter deadline than asked.

Functions§

format_grpc_timeout
Format a Duration as a grpc-timeout header value.
parse_grpc_timeout
Parse a grpc-timeout header value into a Duration. Returns None for malformed input (empty, missing/unknown unit, non-digit body, or arithmetic overflow).