bynk.within.in_pure_context
Error e.within(d) was used in a pure (non-effectful) context.
within hands the effect it abandons on a timeout to the execution context, and only an effectful body has one: a pure function never runs an effect at all. Change the enclosing function's return type to Effect[…] so its body can run it. The same rule holds for bynk.race.in_pure_context.
Example
fn bounded(e: Effect[Int]) -> Int { let r = e.within(1.second) // ✗ the body is pure 0}
fn bounded(e: Effect[Int]) -> Effect[Result[Int, TimedOut]] { // ✓ an effectful body e.within(1.second)}In the Book
See also
- The grammar rule it governs:
method_call. - Every code in its category, Other, on the diagnostic index.
bynk explain bynk.within.in_pure_contextshows the same from the installed toolchain, without a network.