Language / Duration literals

Duration literals

Duration literals represent time spans with unit suffixes (ms, s, min, etc) and produce a Duration value.

Full reference: literals duration.

Example#

fn main () -> int {
  let a: Duration = 10ms;
  let b: Duration = 2s;
  let c: Duration = a + b;
  if c > a { return 0; }
  return 1;
}

See also#

Source repository · Edit this page · View Markdown