All files

src/stdlib/time/async.panack

Green: covered; red: known zero; amber: unavailable. Blank lines are outside the executable-start-line denominator.

    1 pub import stdlib/time/errors::{SleepError, SleepErrorKind}
    2 import stdlib/time/errors as sleep_errors
    3 pub import stdlib/host::{HostError}
    4 pub import stdlib/time::{ClockError, ClockError.ClockUnavailable, DurationError,
    5   DurationError.FractionalNanosecond, DurationError.ZeroDurationDivisor,
    6   nanoseconds, from_fractional_seconds, from_nanoseconds, from_seconds, seconds, milliseconds}
    7 
    8 // An impure monotonic clock read that completes in the current task turn.
    9 pub async now(): Result[Instant,ClockError] {
   10   await instant_now_async()
   11 }
   12 
   13 // Suspend this task; cancellation discards the timer.
   14 pub async sleep(duration: Duration): Result[Unit,SleepError] {
   15   sleep_errors.convert(await host_sleep_async(duration), duration)
   16 }
   17 

Functions

[
  {
    "id": "declaration/4",
    "name": "now",
    "line": 9,
    "state": "covered",
    "entries": "2"
  },
  {
    "id": "declaration/5",
    "name": "sleep",
    "line": 14,
    "state": "covered",
    "entries": "4"
  }
]

Source branch outcomes

[]

Reviewed declaration exclusions

[
  {
    "id": "declaration/0",
    "reason": "import",
    "line": 1
  },
  {
    "id": "declaration/1",
    "reason": "import",
    "line": 2
  },
  {
    "id": "declaration/2",
    "reason": "import",
    "line": 3
  },
  {
    "id": "declaration/3",
    "reason": "import",
    "line": 4
  },
  {
    "id": "declaration/5/tail/receiver",
    "reason": "namespace-qualifier",
    "line": 15
  }
]