OxL Справочник OxL
РусскийEnglish

error invalid-duration

error Стандарт: [§1.5]

Некорректный литерал длительности.

What it means#

Duration units are ns us ms s m h d. A compound duration lists units in strictly decreasing order without spaces, for example 1h30m15s (§1.5). Repeating a unit, writing units in ascending order, or inserting spaces is an error. Months and years are not duration units at all; they belong to Period (§17.2).

Example#

oxl✓ проверяется в CI
fn main() {
  let wait = 30m1h      // <- invalid-duration (units must decrease: h before m)
}
error
invalid-duration

How to fix#

oxl✓ проверяется в CI
fn main() {
  let wait = 1h30m
}

Order the components from the largest unit to the smallest, each at most once. For calendar intervals use Period, e.g. 1.month.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства