123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <!-- This file is generated by Nim. -->
- <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>std/asyncfutures</title>
- <!-- Google fonts -->
- <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
- <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
- <!-- Favicon -->
- <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
- <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
- <!-- CSS -->
- <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
- <!-- JS -->
- <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
- </head>
- <body>
- <div class="document" id="documentId">
- <div class="container">
- <h1 class="title">std/asyncfutures</h1>
- <div class="row">
- <div class="three columns">
- <div class="theme-select-wrapper">
- <label for="theme-select">Theme: </label>
- <select id="theme-select" onchange="setTheme(this.value)">
- <option value="auto">🌗 Match OS</option>
- <option value="dark">🌑 Dark</option>
- <option value="light">🌕 Light</option>
- </select>
- </div>
- <div id="global-links">
- <ul class="simple-boot">
- <li><a href="manual.html">Manual</a></li>
- <li><a href="lib.html">Standard library</a></li>
- <li> <a id="indexLink" href="theindex.html">Index</a></li>
- <li><a href="compiler/theindex.html">Compiler docs</a></li>
- <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
- <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
- </ul>
- </div>
- <div id="searchInputDiv">
- Search: <input type="search" id="searchInput"
- oninput="search()" />
- </div>
-
- <ul class="simple simple-toc" id="toc-list">
- <li>
- <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
- <ul class="simple simple-toc-section">
- <li><a class="reference" href="#Future" title="Future[T] = ref object of FutureBase
- ## Stored value">Future</a></li>
- <li><a class="reference" href="#FutureBase" title="FutureBase = ref object of RootObj
- error*: ref Exception ## Stored exception
- errorStackTrace*: string
- when not defined(release) or defined(futureLogging):
- ## For debugging purposes only.">FutureBase</a></li>
- <li><a class="reference" href="#FutureError" title="FutureError = object of Defect
- cause*: FutureBase">FutureError</a></li>
- <li><a class="reference" href="#FutureVar" title="FutureVar[T] = distinct Future[T]">FutureVar</a></li>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
- <ul class="simple simple-toc-section">
- <li><a class="reference" href="#isFutureLoggingEnabled" title="isFutureLoggingEnabled = false">isFutureLoggingEnabled</a></li>
- <li><a class="reference" href="#NimAsyncContinueSuffix" title="NimAsyncContinueSuffix = "NimAsyncContinue"">NimAsyncContinueSuffix</a></li>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
- <ul class="simple simple-toc-section">
- <ul class="simple nested-toc-section">$
- <li><a class="reference" href="#%24%2Cseq%5BStackTraceEntry%5D" title="`$`(stackTraceEntries: seq[StackTraceEntry]): string">`$`(stackTraceEntries: seq[StackTraceEntry]): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">addCallback
- <li><a class="reference" href="#addCallback%2CFutureBase%2Cproc%29" title="addCallback(future: FutureBase; cb: proc () {.closure, gcsafe.})">addCallback(future: FutureBase; cb: proc () {.closure, gcsafe.})</a></li>
- <li><a class="reference" href="#addCallback%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29" title="addCallback[T](future: Future[T];
- cb: proc (future: Future[T]) {.closure, gcsafe.})">addCallback[T](future: Future[T];
- cb: proc (future: Future[T]) {.closure, gcsafe.})</a></li>
- </ul>
- <ul class="simple nested-toc-section">all
- <li><a class="reference" href="#all%2Cvarargs%5BFuture%5BT%5D%5D" title="all[T](futs: varargs[Future[T]]): auto">all[T](futs: varargs[Future[T]]): auto</a></li>
- </ul>
- <ul class="simple nested-toc-section">and
- <li><a class="reference" href="#and%2CFuture%5BT%5D%2CFuture%5BY%5D" title="`and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]">`and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]</a></li>
- </ul>
- <ul class="simple nested-toc-section">asyncCheck
- <li><a class="reference" href="#asyncCheck%2CFuture%5BT%5D" title="asyncCheck[T](future: Future[T])">asyncCheck[T](future: Future[T])</a></li>
- </ul>
- <ul class="simple nested-toc-section">callback=
- <li><a class="reference" href="#callback%3D%2CFutureBase%2Cproc%29" title="callback=(future: FutureBase; cb: proc () {.closure, gcsafe.})">callback=(future: FutureBase; cb: proc () {.closure, gcsafe.})</a></li>
- <li><a class="reference" href="#callback%3D%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29" title="callback=[T](future: Future[T]; cb: proc (future: Future[T]) {.closure, gcsafe.})">callback=[T](future: Future[T]; cb: proc (future: Future[T]) {.closure, gcsafe.})</a></li>
- </ul>
- <ul class="simple nested-toc-section">callSoon
- <li><a class="reference" href="#callSoon%2Cproc%29" title="callSoon(cbproc: proc () {.gcsafe.})">callSoon(cbproc: proc () {.gcsafe.})</a></li>
- </ul>
- <ul class="simple nested-toc-section">clean
- <li><a class="reference" href="#clean%2CFutureVar%5BT%5D" title="clean[T](future: FutureVar[T])">clean[T](future: FutureVar[T])</a></li>
- </ul>
- <ul class="simple nested-toc-section">clearCallbacks
- <li><a class="reference" href="#clearCallbacks%2CFutureBase" title="clearCallbacks(future: FutureBase)">clearCallbacks(future: FutureBase)</a></li>
- </ul>
- <ul class="simple nested-toc-section">complete
- <li><a class="reference" href="#complete%2CFuture%5Bvoid%5D" title="complete(future: Future[void]; val = Future[void].default)">complete(future: Future[void]; val = Future[void].default)</a></li>
- <li><a class="reference" href="#complete%2CFuture%5BT%5D%2CsinkT" title="complete[T](future: Future[T]; val: sink T)">complete[T](future: Future[T]; val: sink T)</a></li>
- <li><a class="reference" href="#complete%2CFutureVar%5BT%5D" title="complete[T](future: FutureVar[T])">complete[T](future: FutureVar[T])</a></li>
- <li><a class="reference" href="#complete%2CFutureVar%5BT%5D%2CsinkT" title="complete[T](future: FutureVar[T]; val: sink T)">complete[T](future: FutureVar[T]; val: sink T)</a></li>
- </ul>
- <ul class="simple nested-toc-section">fail
- <li><a class="reference" href="#fail%2CFuture%5BT%5D%2Cref.Exception" title="fail[T](future: Future[T]; error: ref Exception)">fail[T](future: Future[T]; error: ref Exception)</a></li>
- </ul>
- <ul class="simple nested-toc-section">failed
- <li><a class="reference" href="#failed%2CFutureBase" title="failed(future: FutureBase): bool">failed(future: FutureBase): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">finished
- <li><a class="reference" href="#finished" title="finished(future: FutureBase | FutureVar): bool">finished(future: FutureBase | FutureVar): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">getCallSoonProc
- <li><a class="reference" href="#getCallSoonProc" title="getCallSoonProc(): (proc (cbproc: proc ()) {.gcsafe.})">getCallSoonProc(): (proc (cbproc: proc ()) {.gcsafe.})</a></li>
- </ul>
- <ul class="simple nested-toc-section">mget
- <li><a class="reference" href="#mget%2CFutureVar%5BT%5D" title="mget[T](future: FutureVar[T]): var T">mget[T](future: FutureVar[T]): var T</a></li>
- </ul>
- <ul class="simple nested-toc-section">newFuture
- <li><a class="reference" href="#newFuture%2Cstring" title="newFuture[T](fromProc: string = "unspecified"): owned(Future[T])">newFuture[T](fromProc: string = "unspecified"): owned(Future[T])</a></li>
- </ul>
- <ul class="simple nested-toc-section">newFutureVar
- <li><a class="reference" href="#newFutureVar%2Cstring" title="newFutureVar[T](fromProc = "unspecified"): owned(FutureVar[T])">newFutureVar[T](fromProc = "unspecified"): owned(FutureVar[T])</a></li>
- </ul>
- <ul class="simple nested-toc-section">or
- <li><a class="reference" href="#or%2CFuture%5BT%5D%2CFuture%5BY%5D" title="`or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]">`or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]</a></li>
- </ul>
- <ul class="simple nested-toc-section">read
- <li><a class="reference" href="#read_2" title="read(future: Future[void] | FutureVar[void])">read(future: Future[void] | FutureVar[void])</a></li>
- <li><a class="reference" href="#read" title="read[T](future: Future[T] | FutureVar[T]): lent T">read[T](future: Future[T] | FutureVar[T]): lent T</a></li>
- </ul>
- <ul class="simple nested-toc-section">readError
- <li><a class="reference" href="#readError%2CFuture%5BT%5D" title="readError[T](future: Future[T]): ref Exception">readError[T](future: Future[T]): ref Exception</a></li>
- </ul>
- <ul class="simple nested-toc-section">setCallSoonProc
- <li><a class="reference" href="#setCallSoonProc" title="setCallSoonProc(p: (proc (cbproc: proc ()) {.gcsafe.}))">setCallSoonProc(p: (proc (cbproc: proc ()) {.gcsafe.}))</a></li>
- </ul>
- </ul>
- </details>
- </li>
- </ul>
- </div>
- <div class="nine columns" id="content">
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L1" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
- <div id="tocRoot"></div>
-
- <p class="module-desc"></p>
- <div class="section" id="6">
- <h1><a class="toc-backref" href="#6">Imports</a></h1>
- <dl class="item">
- <a class="reference external" href="os.html">os</a>, <a class="reference external" href="sets.html">sets</a>, <a class="reference external" href="tables.html">tables</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="times.html">times</a>, <a class="reference external" href="heapqueue.html">heapqueue</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="deques.html">deques</a>, <a class="reference external" href="cstrutils.html">cstrutils</a>, <a class="reference external" href="typetraits.html">typetraits</a>, <a class="reference external" href="stacktraces.html">stacktraces</a>, <a class="reference external" href="objectdollar.html">objectdollar</a>, <a class="reference external" href="assertions.html">assertions</a>
- </dl>
- </div>
- <div class="section" id="7">
- <h1><a class="toc-backref" href="#7">Types</a></h1>
- <dl class="item">
- <div id="Future">
- <dt><pre><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
- <span class="Comment">## Stored value</span></pre></dt>
- <dd>
-
- Typed future.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L37" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L37" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="FutureBase">
- <dt><pre><a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#RootObj"><span class="Identifier">RootObj</span></a>
- <span class="Identifier">error</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a> <span class="Comment">## Stored exception</span>
- <span class="Identifier">errorStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a>
- <span class="Keyword">when</span> <span class="Keyword">not</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">release</span><span class="Other">)</span> <span class="Keyword">or</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">futureLogging</span><span class="Other">)</span><span class="Other">:</span>
- <span class="Comment">## For debugging purposes only.</span></pre></dt>
- <dd>
-
- Untyped future.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L26" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L26" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="FutureError">
- <dt><pre><a href="asyncfutures.html#FutureError"><span class="Identifier">FutureError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#Defect"><span class="Identifier">Defect</span></a>
- <span class="Identifier">cause</span><span class="Operator">*</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L42" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L42" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="FutureVar">
- <dt><pre><a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">distinct</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L40" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L40" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </dl>
- </div>
- <div class="section" id="10">
- <h1><a class="toc-backref" href="#10">Consts</a></h1>
- <dl class="item">
- <div id="isFutureLoggingEnabled">
- <dt><pre><a href="asyncfutures.html#isFutureLoggingEnabled"><span class="Identifier">isFutureLoggingEnabled</span></a> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L48" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L48" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="NimAsyncContinueSuffix">
- <dt><pre><a href="asyncfutures.html#NimAsyncContinueSuffix"><span class="Identifier">NimAsyncContinueSuffix</span></a> <span class="Other">=</span> <span class="StringLit">"NimAsyncContinue"</span></pre></dt>
- <dd>
-
- For internal usage. Do not use.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L51" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L51" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </dl>
- </div>
- <div class="section" id="12">
- <h1><a class="toc-backref" href="#12">Procs</a></h1>
- <dl class="item">
- <div id="$-procs-all">
- <div id="$,seq[StackTraceEntry]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%24%2Cseq%5BStackTraceEntry%5D"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">stackTraceEntries</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#StackTraceEntry"><span class="Identifier">StackTraceEntry</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L314" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L314" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="addCallback-procs-all">
- <div id="addCallback,FutureBase,proc)">
- <dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFutureBase%2Cproc%29"><span class="Identifier">addCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Adds the callbacks proc to be called when the future completes.</p>
- <p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L249" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L249" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="addCallback,Future[T],proc(Future[T])">
- <dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29"><span class="Identifier">addCallback</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
- <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Adds the callbacks proc to be called when the future completes.</p>
- <p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L259" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L259" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="all-procs-all">
- <div id="all,varargs[Future[T]]">
- <dt><pre><span class="Keyword">proc</span> <a href="#all%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">all</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#auto"><span class="Identifier">auto</span></a></pre></dt>
- <dd>
-
- <p>Returns a future which will complete once all futures in <tt class="docutils literal"><span class="pre"><span class="Identifier">futs</span></span></tt> complete. If the argument is empty, the returned future completes immediately.</p>
- <p>If the awaited futures are not <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>, the returned future will hold the values of all awaited futures in a sequence.</p>
- <p>If the awaited futures <em>are</em> <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>, this proc returns <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L459" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L459" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="and-procs-all">
- <div id="and,Future[T],Future[Y]">
- <dt><pre><span class="Keyword">proc</span> <a href="#and%2CFuture%5BT%5D%2CFuture%5BY%5D"><span class="Identifier">`and`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">Y</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut1</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fut2</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">Y</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
- <dd>
-
- Returns a future which will complete once both <tt class="docutils literal"><span class="pre"><span class="Identifier">fut1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">fut2</span></span></tt> complete.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L431" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L431" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="asyncCheck-procs-all">
- <div id="asyncCheck,Future[T]">
- <dt><pre><span class="Keyword">proc</span> <a href="#asyncCheck%2CFuture%5BT%5D"><span class="Identifier">asyncCheck</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Sets a callback on <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> which raises an exception if the future finished with an error.</p>
- <p>This should be used instead of <tt class="docutils literal"><span class="pre"><span class="Keyword">discard</span></span></tt> to discard void futures, or use <tt class="docutils literal"><span class="pre"><span class="Identifier">waitFor</span></span></tt> if you need to wait for the future's completion.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L416" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L416" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="callback=-procs-all">
- <div id="callback=,FutureBase,proc)">
- <dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureBase%2Cproc%29"><span class="Identifier">callback=</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Clears the list of callbacks and sets the callback proc to be called when the future completes.</p>
- <p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
- <p>It's recommended to use <tt class="docutils literal"><span class="pre"><span class="Identifier">addCallback</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">then</span></span></tt> instead.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L269" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L269" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="callback=,Future[T],proc(Future[T])">
- <dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29"><span class="Identifier">callback=</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
- <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Sets the callback proc to be called when the future completes.</p>
- <p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L278" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L278" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="callSoon-procs-all">
- <div id="callSoon,proc)">
- <dt><pre><span class="Keyword">proc</span> <a href="#callSoon%2Cproc%29"><span class="Identifier">callSoon</span></a><span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Call <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> "soon".</p>
- <p>If async dispatcher is running, <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> will be executed during next dispatcher tick.</p>
- <p>If async dispatcher is not running, <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> will be executed immediately.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L100" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="clean-procs-all">
- <div id="clean,FutureVar[T]">
- <dt><pre><span class="Keyword">proc</span> <a href="#clean%2CFutureVar%5BT%5D"><span class="Identifier">clean</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- Resets the <tt class="docutils literal"><span class="pre"><span class="Identifier">finished</span></span></tt> status of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L139" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L139" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="clearCallbacks-procs-all">
- <div id="clearCallbacks,FutureBase">
- <dt><pre><span class="Keyword">proc</span> <a href="#clearCallbacks%2CFutureBase"><span class="Identifier">clearCallbacks</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L245" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L245" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="complete-procs-all">
- <div id="complete,Future[void]">
- <dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFuture%5Bvoid%5D"><span class="Identifier">complete</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span> <span class="Other">=</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">.</span><span class="Identifier">default</span><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L210" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L210" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="complete,Future[T],sinkT">
- <dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFuture%5BT%5D%2CsinkT"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
- <dd>
-
- Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with value <tt class="docutils literal"><span class="pre"><span class="Identifier">val</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L206" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L206" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="complete,FutureVar[T]">
- <dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureVar%5BT%5D"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L213" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L213" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="complete,FutureVar[T],sinkT">
- <dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureVar%5BT%5D%2CsinkT"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt> with value <tt class="docutils literal"><span class="pre"><span class="Identifier">val</span></span></tt>.</p>
- <p>Any previously stored value will be overwritten.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L222" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L222" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="fail-procs-all">
- <div id="fail,Future[T],ref.Exception">
- <dt><pre><span class="Keyword">proc</span> <a href="#fail%2CFuture%5BT%5D%2Cref.Exception"><span class="Identifier">fail</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a><span class="Other">)</span></pre></dt>
- <dd>
-
- Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">error</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L234" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L234" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="failed-procs-all">
- <div id="failed,FutureBase">
- <dt><pre><span class="Keyword">proc</span> <a href="#failed%2CFutureBase"><span class="Identifier">failed</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> completed with an error.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L412" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L412" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="finished-procs-all">
- <div id="finished">
- <dt><pre><span class="Keyword">proc</span> <a href="#finished"><span class="Identifier">finished</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> has completed.</p>
- <p><tt class="docutils literal"><span class="pre"><span class="Identifier">True</span></span></tt> may indicate an error or a value. Use <tt class="docutils literal"><span class="pre"><span class="Identifier">failed</span></span></tt> to distinguish.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L403" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L403" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="getCallSoonProc-procs-all">
- <div id="getCallSoonProc">
- <dt><pre><span class="Keyword">proc</span> <a href="#getCallSoonProc"><span class="Identifier">getCallSoonProc</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- Get current implementation of <tt class="docutils literal"><span class="pre"><span class="Identifier">callSoon</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L92" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L92" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="mget-procs-all">
- <div id="mget,FutureVar[T]">
- <dt><pre><span class="Keyword">proc</span> <a href="#mget%2CFutureVar%5BT%5D"><span class="Identifier">mget</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span></pre></dt>
- <dd>
-
- <p>Returns a mutable value stored in <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.</p>
- <p>Unlike <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt>, this function will not raise an exception if the Future has not been finished.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L396" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L396" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="newFuture-procs-all">
- <div id="newFuture,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#newFuture%2Cstring"><span class="Identifier">newFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">"unspecified"</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Creates a new future.</p>
- <p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L121" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L121" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="newFutureVar-procs-all">
- <div id="newFutureVar,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#newFutureVar%2Cstring"><span class="Identifier">newFutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span> <span class="Other">=</span> <span class="StringLit">"unspecified"</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Create a new <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt>. This Future type is ideally suited for situations where you want to avoid unnecessary allocations of Futures.</p>
- <p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L129" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L129" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="or-procs-all">
- <div id="or,Future[T],Future[Y]">
- <dt><pre><span class="Keyword">proc</span> <a href="#or%2CFuture%5BT%5D%2CFuture%5BY%5D"><span class="Identifier">`or`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">Y</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut1</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fut2</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">Y</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
- <dd>
-
- Returns a future which will complete once either <tt class="docutils literal"><span class="pre"><span class="Identifier">fut1</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">fut2</span></span></tt> complete.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L447" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L447" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="read-procs-all">
- <div id="read_2">
- <dt><pre><span class="Keyword">proc</span> <a href="#read_2"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L384" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L384" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="read">
- <dt><pre><span class="Keyword">proc</span> <a href="#read"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#lent"><span class="Identifier">lent</span></a> <span class="Identifier">T</span></pre></dt>
- <dd>
-
- <p>Retrieves the value of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>. Future must be finished otherwise this function will fail with a <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> exception.</p>
- <p>If the result of the future is an error then that error will be raised.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L377" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L377" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="readError-procs-all">
- <div id="readError,Future[T]">
- <dt><pre><span class="Keyword">proc</span> <a href="#readError%2CFuture%5BT%5D"><span class="Identifier">readError</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a></pre></dt>
- <dd>
-
- <p>Retrieves the exception stored in <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.</p>
- <p>An <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> exception will be thrown if no exception exists in the specified Future.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L387" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L387" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="setCallSoonProc-procs-all">
- <div id="setCallSoonProc">
- <dt><pre><span class="Keyword">proc</span> <a href="#setCallSoonProc"><span class="Identifier">setCallSoonProc</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <span class="Other">(</span><span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- Change current implementation of <tt class="docutils literal"><span class="pre"><span class="Identifier">callSoon</span></span></tt>. This is normally called when dispatcher from <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncdispatcher</span></span></tt> is initialized.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L96" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L96" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- </dl>
- </div>
- </div>
- </div>
- <div class="twelve-columns footer">
- <span class="nim-sprite"></span>
- <br>
- <small style="color: var(--hint);">Made with Nim. Generated: 2024-12-25 08:36:09 UTC</small>
- </div>
- </div>
- </div>
- <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
-
- </body>
- </html>
|