Skip to main content

Module duration

Module duration 

Source
Expand description

The duration grammar at EXPANSION time — every = "10m" read into the value the emission spells.

§ONE grammar, two crates, and why the copy is here rather than borrowed

The user’s ruling on the duration word is that both sides speak ONE grammar: the runtime filter’s DurationFilter::parse_operand and this expansion-time reader accept exactly the same strings and answer with exactly the same values. ingraph cannot lend this crate its copy — ingraph expands THROUGH the derive, which is built on this crate, so the edge would run the wrong way — so the table is copied and PINNED: ingraph-derive’s duration_parity suite reads both files and refuses a byte of drift below the first constant, then reads one corpus through both entries and refuses a difference in either the value or the acceptance.

§The two grammars inside the one

jiff::SignedDuration’s own FromStr runs first — ISO 8601 (PT1H30M30S), jiff’s friendly form (1h 30m 30s), a leading sign on either — and only its refusal reaches [wide], the normalization table that answers the four CALENDAR units jiff declines for this type. jiff first settles the overlap (its reading wins every string it accepts) and settles the ERROR (a string neither grammar takes reports jiff’s refusal, which names the unit it found and where).

The month and the year are fixed averages — 30.44 and 365.25 days — kept as a documented convenience by the user’s own word on the months exception, and not calendar arithmetic. 1M is a MONTH and 1m is a minute.

Functions§

parse
One duration from text, in the grammar both crates speak.