nim / latest / asyncmacro.html

std/asyncmacro

Source Edit

Implements the async and multisync macros for asyncdispatch.

Imports

macros, strutils, asyncfutures

Macros

macro async(prc: untyped): untyped
Macro which processes async procedures into the appropriate iterators and yield statements. Source Edit
macro multisync(prc: untyped): untyped

Macro which processes async procedures into both asynchronous and synchronous procedures.

The generated async procedures use the async macro, whereas the generated synchronous procedures simply strip off the await calls.

Source Edit

Templates

template await(f: typed): untyped {.used.}
Source Edit
template await[T](f: Future[T]): auto {.used.}
Source Edit

© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/asyncmacro.html