Skip to main content

Module units

Module units 

Source
Expand description

Durations ("30s", "5m", "1h30m") and sizes ("4MiB") in configuration values.

Structs§

DurationText
The JSON Schema of a duration field: a string with format duration.
SizeText
The JSON Schema of a size field: a string with format size.

Enums§

MemoryReserve
[worker] memory_reserve: the part of the pod’s memory limit kept out of task budgets.
UnitError
Why a string isn’t a valid duration or size.

Functions§

deserialize_duration
A serde deserialize_with helper for duration fields.
deserialize_mode_text
A serde deserialize_with helper for a file mode in octal text ("0640"). A whole number is taken by its digits, as the environment gives SCHEDR_CONFIG__WORKER__LOG_MODE=0640 as 640: those digits are read as octal too, and checked as the text would be.
deserialize_optional_duration
A serde deserialize_with helper for optional duration fields (None when left out).
deserialize_optional_size
A serde deserialize_with helper for optional size fields (None when left out).
deserialize_size
A serde deserialize_with helper for size fields.
format_duration
Writes a duration as parse_duration reads it, in the largest units that are exact (2m, not 120s; 1h30m; 0s for zero).
format_reserve
Writes a memory reserve as parse_reserve reads it.
format_size
Writes a size as parse_size reads it, in the largest unit that is exact (4MiB, not 4096KiB).
parse_duration
Parses a duration: one or more <number><unit> parts with units ms, s, m, h, d, each unit at most once and from largest to smallest (1h30m, not 30m1h).
parse_reserve
Parses a memory reserve: <n>% with n at most 90, or a size (see parse_size).
parse_size
Parses a size: a whole number followed by B, KiB, MiB or GiB.
serialize_duration
A serde serialize_with helper for duration fields (see format_duration).
serialize_optional_duration
A serde serialize_with helper for optional duration fields (see format_duration).
serialize_optional_size
A serde serialize_with helper for optional size fields (see format_size).
serialize_size
Writes a size as format_size does.