1697 lines
159 KiB
HTML
1697 lines
159 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!-- This file is generated by Nim. -->
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- 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=">
|
|
|
|
<!-- 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'/>
|
|
|
|
<!-- CSS -->
|
|
<title>chronos/internal/asyncfutures</title>
|
|
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
|
|
|
|
<script type="text/javascript" src="../../dochack.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function main() {
|
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
|
for (var i = 0; i < pragmaDots.length; i++) {
|
|
pragmaDots[i].onclick = function(event) {
|
|
// Hide tease
|
|
event.target.parentNode.style.display = "none";
|
|
// Show actual
|
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
|
}
|
|
}
|
|
|
|
function switchTheme(e) {
|
|
if (e.target.checked) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
}
|
|
|
|
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
|
if (toggleSwitch !== null) {
|
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
|
}
|
|
|
|
var currentTheme = localStorage.getItem('theme');
|
|
if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
currentTheme = 'dark';
|
|
}
|
|
if (currentTheme) {
|
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
|
|
|
if (currentTheme === 'dark' && toggleSwitch !== null) {
|
|
toggleSwitch.checked = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener('DOMContentLoaded', main);
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">chronos/internal/asyncfutures</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-switch-wrapper">
|
|
<label class="theme-switch" for="checkbox">
|
|
<input type="checkbox" id="checkbox" />
|
|
<div class="slider round"></div>
|
|
</label>
|
|
<em>Dark Mode</em>
|
|
</div>
|
|
<div id="global-links">
|
|
<ul class="simple">
|
|
<li>
|
|
<a href="../../theindex.html">Index</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#FutureCompletedError"
|
|
title="FutureCompletedError = object of FutureError">FutureCompletedError</a></li>
|
|
<li><a class="reference" href="#FuturePendingError"
|
|
title="FuturePendingError = object of FutureError">FuturePendingError</a></li>
|
|
<li><a class="reference" href="#FutureSeq"
|
|
title="FutureSeq[A; B] = ref object of Future[A]
|
|
gcholder*: seq[B]">FutureSeq</a></li>
|
|
<li><a class="reference" href="#FutureStr"
|
|
title="FutureStr[T] = ref object of Future[T]
|
|
gcholder*: string">FutureStr</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">[]
|
|
<li><a class="reference" href="#%5B%5D%2Carray%5BLocationKind%2Cptr.SrcLoc%5D%2Cint"
|
|
title="`[]`(loc: array[LocationKind, ptr SrcLoc]; v: int): ptr SrcLoc">`[]`(loc: array[LocationKind, ptr SrcLoc]; v: int): ptr SrcLoc</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">addCallback
|
|
<li><a class="reference" href="#addCallback%2CFutureBase%2CCallbackFunc"
|
|
title="addCallback(future: FutureBase; cb: CallbackFunc)">addCallback(future: FutureBase; cb: CallbackFunc)</a></li>
|
|
<li><a class="reference" href="#addCallback%2CFutureBase%2CCallbackFunc%2Cpointer"
|
|
title="addCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)">addCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)</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">allFinished
|
|
<li><a class="reference" href="#allFinished%2Cvarargs%5BF%5D"
|
|
title="allFinished[F: SomeFuture](futs: varargs[F]): InternalRaisesFuture[seq[F],
|
|
(CancelledError,)]">allFinished[F: SomeFuture](futs: varargs[F]): InternalRaisesFuture[seq[F],
|
|
(CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">allFutures
|
|
<li><a class="reference" href="#allFutures%2Cvarargs%5BFutureBase%5D"
|
|
title="allFutures(futs: varargs[FutureBase]): InternalRaisesFuture[void,
|
|
(CancelledError,)]">allFutures(futs: varargs[FutureBase]): InternalRaisesFuture[void,
|
|
(CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#allFutures%2Cvarargs%5BInternalRaisesFuture%5BT%2CE%5D%5D"
|
|
title="allFutures[T, E](futs: varargs[InternalRaisesFuture[T, E]]): InternalRaisesFuture[
|
|
void, (CancelledError,)]">allFutures[T, E](futs: varargs[InternalRaisesFuture[T, E]]): InternalRaisesFuture[
|
|
void, (CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#allFutures%2Cvarargs%5BFuture%5BT%5D%5D"
|
|
title="allFutures[T](futs: varargs[Future[T]]): InternalRaisesFuture[void,
|
|
(CancelledError,)]">allFutures[T](futs: varargs[Future[T]]): InternalRaisesFuture[void,
|
|
(CancelledError,)]</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">asyncDiscard
|
|
<li><a class="reference" href="#asyncDiscard%2CFuture%5BT%5D"
|
|
title="asyncDiscard[T](future: Future[T])">asyncDiscard[T](future: Future[T])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">asyncSpawn
|
|
<li><a class="reference" href="#asyncSpawn%2CFuture%5Bvoid%5D"
|
|
title="asyncSpawn(future: Future[void])">asyncSpawn(future: Future[void])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">callback=
|
|
<li><a class="reference" href="#callback%3D%2CFutureBase%2CCallbackFunc"
|
|
title="callback=(future: FutureBase; cb: CallbackFunc)">callback=(future: FutureBase; cb: CallbackFunc)</a></li>
|
|
<li><a class="reference" href="#callback%3D%2CFutureBase%2CCallbackFunc%2Cpointer"
|
|
title="callback=(future: FutureBase; cb: CallbackFunc; udata: pointer)">callback=(future: FutureBase; cb: CallbackFunc; udata: pointer)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">cancelAndWait
|
|
<li><a class="reference" href="#cancelAndWait%2CFutureBase%2Cptr.SrcLoc"
|
|
title="cancelAndWait(future: FutureBase; loc: ptr SrcLoc): InternalRaisesFuture[void,
|
|
void]">cancelAndWait(future: FutureBase; loc: ptr SrcLoc): InternalRaisesFuture[void,
|
|
void]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">cancelCallback=
|
|
<li><a class="reference" href="#cancelCallback%3D%2CFutureBase%2CCallbackFunc"
|
|
title="cancelCallback=(future: FutureBase; cb: CallbackFunc)">cancelCallback=(future: FutureBase; cb: CallbackFunc)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">done
|
|
<li><a class="reference" href="#done%2CFutureBase"
|
|
title="done(future: FutureBase): bool">done(future: FutureBase): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">futureContinue
|
|
<li><a class="reference" href="#futureContinue%2CFutureBase"
|
|
title="futureContinue(fut: FutureBase)">futureContinue(fut: FutureBase)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">idleAsync
|
|
<li><a class="reference" href="#idleAsync"
|
|
title="idleAsync(): InternalRaisesFuture[void, (CancelledError,)]">idleAsync(): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">join
|
|
<li><a class="reference" href="#join%2CFutureBase"
|
|
title="join(future: FutureBase): InternalRaisesFuture[void, (CancelledError,)]">join(future: FutureBase): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#join%2CSomeFuture"
|
|
title="join(future: SomeFuture): InternalRaisesFuture[void, (CancelledError,)]">join(future: SomeFuture): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">noCancel
|
|
<li><a class="reference" href="#noCancel%2CF"
|
|
title="noCancel[F: SomeFuture](future: F): auto">noCancel[F: SomeFuture](future: F): auto</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">one
|
|
<li><a class="reference" href="#one%2CF%2Cvarargs%5BF%5D"
|
|
title="one[F: SomeFuture](fut0: F; futs: varargs[F]): InternalRaisesFuture[F,
|
|
(CancelledError,)]">one[F: SomeFuture](fut0: F; futs: varargs[F]): InternalRaisesFuture[F,
|
|
(CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#one%2CopenArray%5BF%5D"
|
|
title="one[F: SomeFuture](futs: openArray[F]): InternalRaisesFuture[F,
|
|
(ValueError, CancelledError)]">one[F: SomeFuture](futs: openArray[F]): InternalRaisesFuture[F,
|
|
(ValueError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">oneIndex
|
|
<li><a class="reference" href="#oneIndex%2Cvarargs%5BFuture%5BT%5D%5D"
|
|
title="oneIndex[T](futs: varargs[Future[T]]): Future[int]">oneIndex[T](futs: varargs[Future[T]]): Future[int]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">oneValue
|
|
<li><a class="reference" href="#oneValue%2Cvarargs%5BFuture%5BT%5D%5D"
|
|
title="oneValue[T](futs: varargs[Future[T]]): Future[T]">oneValue[T](futs: varargs[Future[T]]): Future[T]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">or
|
|
<li><a class="reference" href="#or%2CInternalRaisesFuture%5BT%2CE1%5D%2CInternalRaisesFuture%5BY%2CE2%5D"
|
|
title="`or`[T, Y, E1, E2](fut1: InternalRaisesFuture[T, E1];
|
|
fut2: InternalRaisesFuture[Y, E2]): auto">`or`[T, Y, E1, E2](fut1: InternalRaisesFuture[T, E1];
|
|
fut2: InternalRaisesFuture[Y, E2]): auto</a></li>
|
|
<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">race
|
|
<li><a class="reference" href="#race%2CFutureBase%2Cvarargs%5BFutureBase%5D"
|
|
title="race(fut0: FutureBase; futs: varargs[FutureBase]): InternalRaisesFuture[
|
|
FutureBase, (CancelledError,)]">race(fut0: FutureBase; futs: varargs[FutureBase]): InternalRaisesFuture[
|
|
FutureBase, (CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#race%2CopenArray%5BFutureBase%5D"
|
|
title="race(futs: openArray[FutureBase]): InternalRaisesFuture[FutureBase,
|
|
(ValueError, CancelledError)]">race(futs: openArray[FutureBase]): InternalRaisesFuture[FutureBase,
|
|
(ValueError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#race%2CopenArray%5BSomeFuture%5D"
|
|
title="race(futs: openArray[SomeFuture]): InternalRaisesFuture[FutureBase,
|
|
(ValueError, CancelledError)]">race(futs: openArray[SomeFuture]): InternalRaisesFuture[FutureBase,
|
|
(ValueError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">read
|
|
<li><a class="reference" href="#read%2CFuture%5Bvoid%5D"
|
|
title="read(fut: Future[void])">read(fut: Future[void])</a></li>
|
|
<li><a class="reference" href="#read%2CInternalRaisesFuture%5Bvoid%2CE%5D"
|
|
title="read[E](fut: InternalRaisesFuture[void, E])">read[E](fut: InternalRaisesFuture[void, E])</a></li>
|
|
<li><a class="reference" href="#read%2CInternalRaisesFuture%5BT%3A%20not%20void%2CE%5D"
|
|
title="read[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T">read[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T</a></li>
|
|
<li><a class="reference" href="#read%2CFuture%5BT%3A%20not%20void%5D"
|
|
title="read[T: not void](fut: Future[T]): lent T">read[T: not void](fut: Future[T]): lent T</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readError
|
|
<li><a class="reference" href="#readError%2CFutureBase"
|
|
title="readError(fut: FutureBase): ref CatchableError">readError(fut: FutureBase): ref CatchableError</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">removeCallback
|
|
<li><a class="reference" href="#removeCallback%2CFutureBase%2CCallbackFunc"
|
|
title="removeCallback(future: FutureBase; cb: CallbackFunc)">removeCallback(future: FutureBase; cb: CallbackFunc)</a></li>
|
|
<li><a class="reference" href="#removeCallback%2CFutureBase%2CCallbackFunc%2Cpointer"
|
|
title="removeCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)">removeCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">sleepAsync
|
|
<li><a class="reference" href="#sleepAsync%2CDuration"
|
|
title="sleepAsync(duration: Duration): InternalRaisesFuture[void, (CancelledError,)]">sleepAsync(duration: Duration): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#sleepAsync%2Cint"
|
|
title="sleepAsync(ms: int): InternalRaisesFuture[void, (CancelledError,)]">sleepAsync(ms: int): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">stepsAsync
|
|
<li><a class="reference" href="#stepsAsync%2Cint"
|
|
title="stepsAsync(number: int): InternalRaisesFuture[void, (CancelledError,)]">stepsAsync(number: int): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">wait
|
|
<li><a class="reference" href="#wait%2CInternalRaisesFuture%2CSomeFuture"
|
|
title="wait(fut: InternalRaisesFuture; deadline: SomeFuture): auto">wait(fut: InternalRaisesFuture; deadline: SomeFuture): auto</a></li>
|
|
<li><a class="reference" href="#wait%2CInternalRaisesFuture"
|
|
title="wait(fut: InternalRaisesFuture; timeout = InfiniteDuration): auto">wait(fut: InternalRaisesFuture; timeout = InfiniteDuration): auto</a></li>
|
|
<li><a class="reference" href="#wait%2CFuture%5BT%5D%2CSomeFuture"
|
|
title="wait[T](fut: Future[T]; deadline: SomeFuture): Future[T]">wait[T](fut: Future[T]; deadline: SomeFuture): Future[T]</a></li>
|
|
<li><a class="reference" href="#wait%2CFuture%5BT%5D%2Cint"
|
|
title="wait[T](fut: Future[T]; timeout = -1): Future[T]">wait[T](fut: Future[T]; timeout = -1): Future[T]</a></li>
|
|
<li><a class="reference" href="#wait%2CFuture%5BT%5D"
|
|
title="wait[T](fut: Future[T]; timeout = InfiniteDuration): Future[T]">wait[T](fut: Future[T]; timeout = InfiniteDuration): Future[T]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">waitFor
|
|
<li><a class="reference" href="#waitFor%2CFuture%5Bvoid%5D"
|
|
title="waitFor(fut: Future[void])">waitFor(fut: Future[void])</a></li>
|
|
<li><a class="reference" href="#waitFor%2CInternalRaisesFuture%5Bvoid%2CE%5D"
|
|
title="waitFor[E](fut: InternalRaisesFuture[void, E])">waitFor[E](fut: InternalRaisesFuture[void, E])</a></li>
|
|
<li><a class="reference" href="#waitFor%2CInternalRaisesFuture%5BT%3A%20not%20void%2CE%5D"
|
|
title="waitFor[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T">waitFor[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T</a></li>
|
|
<li><a class="reference" href="#waitFor%2CFuture%5BT%3A%20not%20void%5D"
|
|
title="waitFor[T: not void](fut: Future[T]): lent T">waitFor[T: not void](fut: Future[T]): lent T</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">withTimeout
|
|
<li><a class="reference" href="#withTimeout%2CFuture%5BT%5D%2CDuration"
|
|
title="withTimeout[T](fut: Future[T]; timeout: Duration): InternalRaisesFuture[bool,
|
|
(CancelledError,)]">withTimeout[T](fut: Future[T]; timeout: Duration): InternalRaisesFuture[bool,
|
|
(CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#withTimeout%2CFuture%5BT%5D%2Cint"
|
|
title="withTimeout[T](fut: Future[T]; timeout: int): Future[bool]">withTimeout[T](fut: Future[T]; timeout: int): Future[bool]</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#17" id="67">Macros</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">internalRaiseIfError
|
|
<li><a class="reference" href="#internalRaiseIfError.m%2CFutureBase%2Ctyped"
|
|
title="internalRaiseIfError(fut: FutureBase; info: typed)">internalRaiseIfError(fut: FutureBase; info: typed)</a></li>
|
|
<li><a class="reference" href="#internalRaiseIfError.m%2CInternalRaisesFuture%2Ctyped%2Ctyped"
|
|
title="internalRaiseIfError(fut: InternalRaisesFuture; raises, info: typed)">internalRaiseIfError(fut: InternalRaisesFuture; raises, info: typed)</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#18" id="68">Templates</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">cancel
|
|
<li><a class="reference" href="#cancel.t%2CFutureBase"
|
|
title="cancel(future: FutureBase)">cancel(future: FutureBase)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">cancelAndSchedule
|
|
<li><a class="reference" href="#cancelAndSchedule.t%2CFutureBase"
|
|
title="cancelAndSchedule(future: FutureBase)">cancelAndSchedule(future: FutureBase)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">cancelAndWait
|
|
<li><a class="reference" href="#cancelAndWait.t%2CFutureBase"
|
|
title="cancelAndWait(future: FutureBase): Future[void].Raising([])">cancelAndWait(future: FutureBase): Future[void].Raising([])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">cancelSoon
|
|
<li><a class="reference" href="#cancelSoon.t%2CFutureBase"
|
|
title="cancelSoon(fut: FutureBase)">cancelSoon(fut: FutureBase)</a></li>
|
|
<li><a class="reference" href="#cancelSoon.t%2CFutureBase%2CInternalAsyncCallback"
|
|
title="cancelSoon(fut: FutureBase; acb: AsyncCallback)">cancelSoon(fut: FutureBase; acb: AsyncCallback)</a></li>
|
|
<li><a class="reference" href="#cancelSoon.t%2CFutureBase%2CCallbackFunc"
|
|
title="cancelSoon(fut: FutureBase; cb: CallbackFunc)">cancelSoon(fut: FutureBase; cb: CallbackFunc)</a></li>
|
|
<li><a class="reference" href="#cancelSoon.t%2CFutureBase%2CCallbackFunc%2Cpointer"
|
|
title="cancelSoon(fut: FutureBase; cb: CallbackFunc; udata: pointer)">cancelSoon(fut: FutureBase; cb: CallbackFunc; udata: pointer)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">complete
|
|
<li><a class="reference" href="#complete.t%2CFuture%5Bvoid%5D"
|
|
title="complete(future: Future[void])">complete(future: Future[void])</a></li>
|
|
<li><a class="reference" href="#complete.t%2CFuture%5BT%5D%2CT"
|
|
title="complete[T](future: Future[T]; val: T)">complete[T](future: Future[T]; val: T)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fail
|
|
<li><a class="reference" href="#fail.t%2CInternalRaisesFuture%5BT%2CE%5D%2Cref.CatchableError%2Cstaticbool"
|
|
title="fail[T, E](future: InternalRaisesFuture[T, E]; error: ref CatchableError;
|
|
warn: static bool = true)">fail[T, E](future: InternalRaisesFuture[T, E]; error: ref CatchableError;
|
|
warn: static bool = true)</a></li>
|
|
<li><a class="reference" href="#fail.t%2CFuture%5BT%5D%2Cref.CatchableError%2Cstaticbool"
|
|
title="fail[T](future: Future[T]; error: ref CatchableError; warn: static bool = false)">fail[T](future: Future[T]; error: ref CatchableError; warn: static bool = false)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">Finished
|
|
<li><a class="reference" href="#Finished.t"
|
|
title="Finished()">Finished()</a></li>
|
|
<li><a class="reference" href="#Finished.t%2CtypeFutureState"
|
|
title="Finished(T: type FutureState): FutureState">Finished(T: type FutureState): FutureState</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">LocCompleteIndex
|
|
<li><a class="reference" href="#LocCompleteIndex.t"
|
|
title="LocCompleteIndex(): untyped">LocCompleteIndex(): untyped</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">LocCreateIndex
|
|
<li><a class="reference" href="#LocCreateIndex.t"
|
|
title="LocCreateIndex(): auto">LocCreateIndex(): auto</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">LocFinishIndex
|
|
<li><a class="reference" href="#LocFinishIndex.t"
|
|
title="LocFinishIndex(): auto">LocFinishIndex(): auto</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newFuture
|
|
<li><a class="reference" href="#newFuture.t%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"
|
|
title="newFuture[T](fromProc: static[string] = ""; flags: static[FutureFlags] = {}): auto">newFuture[T](fromProc: static[string] = ""; flags: static[FutureFlags] = {}): auto</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newFutureSeq
|
|
<li><a class="reference" href="#newFutureSeq.t%2Cstatic%5Bstring%5D"
|
|
title="newFutureSeq[A, B](fromProc: static[string] = ""): FutureSeq[A, B]">newFutureSeq[A, B](fromProc: static[string] = ""): FutureSeq[A, B]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newFutureStr
|
|
<li><a class="reference" href="#newFutureStr.t%2Cstatic%5Bstring%5D"
|
|
title="newFutureStr[T](fromProc: static[string] = ""): FutureStr[T]">newFutureStr[T](fromProc: static[string] = ""): FutureStr[T]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newInternalRaisesFuture
|
|
<li><a class="reference" href="#newInternalRaisesFuture.t%2Cstatic%5Bstring%5D"
|
|
title="newInternalRaisesFuture[T, E](fromProc: static[string] = ""): auto">newInternalRaisesFuture[T, E](fromProc: static[string] = ""): auto</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">orImpl
|
|
<li><a class="reference" href="#orImpl.t%2CFuture%5BT%5D%2CFuture%5BY%5D"
|
|
title="orImpl[T, Y](fut1: Future[T]; fut2: Future[Y]): untyped">orImpl[T, Y](fut1: Future[T]; fut2: Future[Y]): untyped</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">tryCancel
|
|
<li><a class="reference" href="#tryCancel.t%2CFutureBase"
|
|
title="tryCancel(future: FutureBase): bool">tryCancel(future: FutureBase): bool</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc">Features and utilities for <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> that integrate it with the dispatcher and the rest of the async machinery</p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="asyncengine.html">asyncengine</a>, <a class="reference external" href="raisesfutures.html">raisesfutures</a>, <a class="reference external" href="../config.html">../config</a>, <a class="reference external" href="../futures.html">../futures</a>
|
|
</dl></div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<div id="FutureCompletedError">
|
|
<dt><pre><a href="asyncfutures.html#FutureCompletedError"><span class="Identifier">FutureCompletedError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../futures.html#FutureError"><span class="Identifier">FutureError</span></a>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
Error raised when trying access the error of a completed Future
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L60"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L60" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="FuturePendingError">
|
|
<dt><pre><a href="asyncfutures.html#FuturePendingError"><span class="Identifier">FuturePendingError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../futures.html#FutureError"><span class="Identifier">FutureError</span></a>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
Error raised when trying to <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt> a Future that is still pending
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L58"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L58" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="FutureSeq">
|
|
<dt><pre><a href="asyncfutures.html#FutureSeq"><span class="Identifier">FutureSeq</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">;</span> <span class="Identifier">B</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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span>
|
|
<span class="Identifier">gcholder</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">B</span><span class="Other">]</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
Deprecated
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L54"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L54" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="FutureStr">
|
|
<dt><pre><a href="asyncfutures.html#FutureStr"><span class="Identifier">FutureStr</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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span>
|
|
<span class="Identifier">gcholder</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
Deprecated
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L50"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L50" 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="[],array[LocationKind,ptr.SrcLoc],int">
|
|
<dt><pre><span class="Keyword">func</span> <a href="#%5B%5D%2Carray%5BLocationKind%2Cptr.SrcLoc%5D%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">loc</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">LocationKind</span><span class="Other">,</span> <span class="Keyword">ptr</span> <a href="../srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="../srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"use LocationKind"</span><span class="Other">,</span> <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>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> use LocationKind
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L42"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L42" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<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="../futures.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="../futures.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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use allFutures[T](varargs[Future[T]])"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use allFutures[T](varargs[Future[T]])
|
|
</div>
|
|
|
|
<p>Returns a future which will complete once both <tt class="docutils literal"><span class="pre">fut1</span></tt> and <tt class="docutils literal"><span class="pre">fut2</span></tt> finish.</p>
|
|
<p>If cancelled, <tt class="docutils literal"><span class="pre">fut1</span></tt> and <tt class="docutils literal"><span class="pre">fut2</span></tt> futures WILL NOT BE cancelled.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L706"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L706" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="or,InternalRaisesFuture[T,E1],InternalRaisesFuture[Y,E2]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#or%2CInternalRaisesFuture%5BT%2CE1%5D%2CInternalRaisesFuture%5BY%2CE2%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="Identifier">E1</span><span class="Other">,</span> <span class="Identifier">E2</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut1</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E1</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">fut2</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">Y</span><span class="Other">,</span> <span class="Identifier">E2</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1841"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1841" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<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="../futures.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="../futures.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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Returns a future which will complete once either <tt class="docutils literal"><span class="pre">fut1</span></tt> or <tt class="docutils literal"><span class="pre">fut2</span></tt> finish.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre">fut1</span></tt> or <tt class="docutils literal"><span class="pre">fut2</span></tt> future is failed, the result future will also be failed with an error stored in <tt class="docutils literal"><span class="pre">fut1</span></tt> or <tt class="docutils literal"><span class="pre">fut2</span></tt> respectively.</p>
|
|
<p>If both <tt class="docutils literal"><span class="pre">fut1</span></tt> and <tt class="docutils literal"><span class="pre">fut2</span></tt> future are completed or failed, the result future will depend on the state of <tt class="docutils literal"><span class="pre">fut1</span></tt> future. So if <tt class="docutils literal"><span class="pre">fut1</span></tt> future is failed, the result future will also be failed, if <tt class="docutils literal"><span class="pre">fut1</span></tt> future is completed, the result future will also be completed.</p>
|
|
<p>If cancelled, <tt class="docutils literal"><span class="pre">fut1</span></tt> and <tt class="docutils literal"><span class="pre">fut2</span></tt> futures WILL NOT BE cancelled.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L780"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L780" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="addCallback,FutureBase,CallbackFunc">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFutureBase%2CCallbackFunc"><span class="Identifier">addCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</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="Identifier">RootEffect</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">cb</span></tt> will be called immediately.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L303"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L303" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="addCallback,FutureBase,CallbackFunc,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFutureBase%2CCallbackFunc%2Cpointer"><span class="Identifier">addCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</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="Identifier">RootEffect</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">cb</span></tt> will be called immediately.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L293"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L293" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<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> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.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> <span class="Identifier">auto</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use allFutures(varargs[Future[T]])"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use allFutures(varargs[Future[T]])
|
|
</div>
|
|
|
|
<p>Returns a future which will complete once all futures in <tt class="docutils literal"><span class="pre">futs</span></tt> finish. 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">Future[void]</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">Future[void]</span></tt>, this proc returns <tt class="docutils literal"><span class="pre">Future[void]</span></tt>.</p>
|
|
<p>Note, that if one of the futures in <tt class="docutils literal"><span class="pre">futs</span></tt> will fail, result of <tt class="docutils literal"><span class="pre">all()</span></tt> will also be failed with error from failed future.</p>
|
|
<p>TODO: This procedure has bug on handling cancelled futures from <tt class="docutils literal"><span class="pre">futs</span></tt>. So if future from <tt class="docutils literal"><span class="pre">futs</span></tt> list become cancelled, what must be returned? You can't cancel result <tt class="docutils literal"><span class="pre">retFuture</span></tt> because in such way infinite recursion will happen.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L797"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L797" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="allFinished,varargs[F]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allFinished%2Cvarargs%5BF%5D"><span class="Identifier">allFinished</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">F</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">F</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1127"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1127" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="allFutures,varargs[FutureBase]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allFutures%2Cvarargs%5BFutureBase%5D"><span class="Identifier">allFutures</span></a><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1064"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1064" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="allFutures,varargs[InternalRaisesFuture[T,E]]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allFutures%2Cvarargs%5BInternalRaisesFuture%5BT%2CE%5D%5D"><span class="Identifier">allFutures</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1116"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1116" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="allFutures,varargs[Future[T]]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allFutures%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">allFutures</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> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.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="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1105"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1105" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<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="../futures.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><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Raises Defect on future failure, fix your code and use asyncSpawn!"</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Raises Defect on future failure, fix your code and use asyncSpawn!
|
|
</div>
|
|
|
|
This function used to raise an exception through the <tt class="docutils literal"><span class="pre"><span class="Identifier">poll</span></span></tt> call if the given future failed - there's no way to handle such exceptions so this function is now an alias for <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncSpawn</span></span></tt>
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L677"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L677" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="asyncDiscard,Future[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#asyncDiscard%2CFuture%5BT%5D"><span class="Identifier">asyncDiscard</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="../futures.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><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use asyncSpawn or `discard await`"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use asyncSpawn or `discard await`
|
|
</div>
|
|
|
|
<tt class="docutils literal"><span class="pre"><span class="Identifier">asyncDiscard</span></span></tt> will discard the outcome of the operation - unlike <tt class="docutils literal"><span class="pre"><span class="Keyword">discard</span></span></tt> it also throws away exceptions! Use <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncSpawn</span></span></tt> if you're sure your code doesn't raise exceptions, or <tt class="docutils literal"><span class="pre"><span class="Keyword">discard</span> <span class="Identifier">await</span></span></tt> to ignore successful outcomes
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L699"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L699" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="asyncSpawn,Future[void]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#asyncSpawn%2CFuture%5Bvoid%5D"><span class="Identifier">asyncSpawn</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Spawns a new concurrent async task.</p>
|
|
<p>Tasks may not raise exceptions or be cancelled - a <tt class="docutils literal"><span class="pre">Defect</span></tt> will be raised when this happens.</p>
|
|
<p>This should be used instead of <tt class="docutils literal"><span class="pre">discard</span></tt> and <tt class="docutils literal"><span class="pre">asyncCheck</span></tt> when calling an <tt class="docutils literal"><span class="pre">async</span></tt> procedure without <tt class="docutils literal"><span class="pre">await</span></tt>, to ensure exceptions in the returned future are not silently discarded.</p>
|
|
<p>Note, that if passed <tt class="docutils literal"><span class="pre">future</span></tt> is already finished, it will be checked and processed immediately.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L651"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L651" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="callback=,FutureBase,CallbackFunc">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureBase%2CCallbackFunc"><span class="Identifier">callback=</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"use addCallback/removeCallback/clearCallbacks instead to manage the callback list"</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> use addCallback/removeCallback/clearCallbacks instead to manage the callback list
|
|
</div>
|
|
|
|
<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">cb</span></tt> will be called immediately.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L334"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L334" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="callback=,FutureBase,CallbackFunc,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureBase%2CCallbackFunc%2Cpointer"><span class="Identifier">callback=</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"use addCallback/removeCallback/clearCallbacks to manage the callback list"</span><span class="Other">,</span>
|
|
<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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> use addCallback/removeCallback/clearCallbacks to manage the callback list
|
|
</div>
|
|
|
|
<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">cb</span></tt> will be called immediately.</p>
|
|
<p>It's recommended to use <tt class="docutils literal"><span class="pre">addCallback</span></tt> or <tt class="docutils literal"><span class="pre">then</span></tt> instead.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L322"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L322" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelAndWait,FutureBase,ptr.SrcLoc">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cancelAndWait%2CFutureBase%2Cptr.SrcLoc"><span class="Identifier">cancelAndWait</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">loc</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="../srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L993"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L993" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelCallback=,FutureBase,CallbackFunc">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cancelCallback%3D%2CFutureBase%2CCallbackFunc"><span class="Identifier">cancelCallback=</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Sets the callback procedure to be called when the future is cancelled.</p>
|
|
<p>This callback will be called immediately as <tt class="docutils literal"><span class="pre">future.cancel()</span></tt> invoked and must be set before future is finished.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L343"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L343" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="done,FutureBase">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#done%2CFutureBase"><span class="Identifier">done</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use `completed` instead"</span><span class="Other">,</span>
|
|
<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>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use `completed` instead
|
|
</div>
|
|
|
|
This is an alias for <tt class="docutils literal"><span class="pre">completed(future)</span></tt> procedure.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L135"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L135" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="futureContinue,FutureBase">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#futureContinue%2CFutureBase"><span class="Identifier">futureContinue</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">gcsafe</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L362"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L362" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="idleAsync">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#idleAsync"><span class="Identifier">idleAsync</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1428"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1428" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="join,FutureBase">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#join%2CFutureBase"><span class="Identifier">join</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1696"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1696" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="join,SomeFuture">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#join%2CSomeFuture"><span class="Identifier">join</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1721"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1721" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="noCancel,F">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#noCancel%2CF"><span class="Identifier">noCancel</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <span class="Identifier">F</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Prevent cancellation requests from propagating to <tt class="docutils literal"><span class="pre">future</span></tt> while forwarding its value or error when it finishes.</p>
|
|
<p>This procedure should be used when you need to perform operations which should not be cancelled at all cost, for example closing sockets, pipes, connections or servers. Usually it become useful in exception or finally blocks.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1018"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1018" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="one,F,varargs[F]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#one%2CF%2Cvarargs%5BF%5D"><span class="Identifier">one</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut0</span><span class="Other">:</span> <span class="Identifier">F</span><span class="Other">;</span> <span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">F</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1212"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1212" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="one,openArray[F]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#one%2CopenArray%5BF%5D"><span class="Identifier">one</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">F</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">F</span><span class="Other">,</span>
|
|
<span class="Other">(</span><span class="Identifier">ValueError</span><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1227"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1227" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="oneIndex,varargs[Future[T]]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#oneIndex%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">oneIndex</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> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use one[T](varargs[Future[T]])"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use one[T](varargs[Future[T]])
|
|
</div>
|
|
|
|
<p>Returns a future which will complete once one of the futures in <tt class="docutils literal"><span class="pre">futs</span></tt> complete.</p>
|
|
<p>If the argument is empty, the returned future FAILS immediately.</p>
|
|
<p>Returned future will hold index of completed/failed future in <tt class="docutils literal"><span class="pre">futs</span></tt> argument.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L866"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L866" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="oneValue,varargs[Future[T]]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#oneValue%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">oneValue</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> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.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="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use one[T](varargs[Future[T]])"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use one[T](varargs[Future[T]])
|
|
</div>
|
|
|
|
<p>Returns a future which will finish once one of the futures in <tt class="docutils literal"><span class="pre">futs</span></tt> finish.</p>
|
|
<p>If the argument is empty, returned future FAILS immediately.</p>
|
|
<p>Returned future will hold value of completed <tt class="docutils literal"><span class="pre">futs</span></tt> future, or error if future was failed.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L897"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L897" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="race,FutureBase,varargs[FutureBase]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#race%2CFutureBase%2Cvarargs%5BFutureBase%5D"><span class="Identifier">race</span></a><span class="Other">(</span><span class="Identifier">fut0</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1289"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1289" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="race,openArray[FutureBase]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#race%2CopenArray%5BFutureBase%5D"><span class="Identifier">race</span></a><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">,</span>
|
|
<span class="Other">(</span><span class="Identifier">ValueError</span><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1304"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1304" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="race,openArray[SomeFuture]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#race%2CopenArray%5BSomeFuture%5D"><span class="Identifier">race</span></a><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">SomeFuture</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">,</span>
|
|
<span class="Other">(</span><span class="Identifier">ValueError</span><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1322"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1322" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,Future[void]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CFuture%5Bvoid%5D"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</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="Identifier">CatchableError</span><span class="Other">]</span><span class="Other">,</span> <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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Checks that <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> completed.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>If the future is still pending, <tt class="docutils literal"><span class="pre"><span class="Identifier">FuturePendingError</span></span></tt> will be raised.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L569"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L569" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,InternalRaisesFuture[void,E]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CInternalRaisesFuture%5Bvoid%2CE%5D"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Checks that <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> completed.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>If the future is still pending, <tt class="docutils literal"><span class="pre"><span class="Identifier">FuturePendingError</span></span></tt> will be raised.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1806"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1806" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,InternalRaisesFuture[T: not void,E]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CInternalRaisesFuture%5BT%3A%20not%20void%2CE%5D"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">;</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">lent</span> <span class="Identifier">T</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Retrieves the value of <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt>.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>If the future is still pending, <tt class="docutils literal"><span class="pre"><span class="Identifier">FuturePendingError</span></span></tt> will be raised.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1794"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1794" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,Future[T: not void]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CFuture%5BT%3A%20not%20void%5D"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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="Identifier">lent</span> <span class="Identifier">T</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">CatchableError</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Retrieves the value of <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt>.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>If the future is still pending, <tt class="docutils literal"><span class="pre"><span class="Identifier">FuturePendingError</span></span></tt> will be raised.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L557"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L557" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readError,FutureBase">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readError%2CFutureBase"><span class="Identifier">readError</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="../futures.html#FutureError"><span class="Identifier">FutureError</span></a><span class="Other">]</span><span class="Other">,</span>
|
|
<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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Retrieves the exception of the failed or cancelled <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt>.</p>
|
|
<p>If the future was completed with a value, <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureCompletedError</span></span></tt> will be raised.</p>
|
|
<p>If the future is still pending, <tt class="docutils literal"><span class="pre"><span class="Identifier">FuturePendingError</span></span></tt> will be raised.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L581"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L581" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="removeCallback,FutureBase,CallbackFunc">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#removeCallback%2CFutureBase%2CCallbackFunc"><span class="Identifier">removeCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L319"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L319" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="removeCallback,FutureBase,CallbackFunc,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#removeCallback%2CFutureBase%2CCallbackFunc%2Cpointer"><span class="Identifier">removeCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
Remove future from list of callbacks - this operation may be slow if there are many registered callbacks!
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L309"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L309" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="sleepAsync,Duration">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#sleepAsync%2CDuration"><span class="Identifier">sleepAsync</span></a><span class="Other">(</span><span class="Identifier">duration</span><span class="Other">:</span> <a href="../timer.html#Duration"><span class="Identifier">Duration</span></a><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<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>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1373"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1373" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="sleepAsync,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#sleepAsync%2Cint"><span class="Identifier">sleepAsync</span></a><span class="Other">(</span><span class="Identifier">ms</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use sleepAsync(Duration)"</span><span class="Other">,</span> </span><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use sleepAsync(Duration)
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1396"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1396" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="stepsAsync,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#stepsAsync%2Cint"><span class="Identifier">stepsAsync</span></a><span class="Other">(</span><span class="Identifier">number</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1400"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1400" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="wait,InternalRaisesFuture,SomeFuture">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CInternalRaisesFuture%2CSomeFuture"><span class="Identifier">wait</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">;</span> <span class="Identifier">deadline</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1863"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1863" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="wait,InternalRaisesFuture">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CInternalRaisesFuture"><span class="Identifier">wait</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">;</span> <span class="Identifier">timeout</span> <span class="Other">=</span> <span class="Identifier">InfiniteDuration</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1850"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1850" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="wait,Future[T],SomeFuture">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CFuture%5BT%5D%2CSomeFuture"><span class="Identifier">wait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">deadline</span><span class="Other">:</span> <span class="Identifier">SomeFuture</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Returns a future which will complete once future <tt class="docutils literal"><span class="pre">fut</span></tt> completes or if <tt class="docutils literal"><span class="pre">deadline</span></tt> future completes.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">deadline</span></span></tt> future completes before future <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> - <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncTimeoutError</span></span></tt> exception will be raised.</p>
|
|
<p>Note: <tt class="docutils literal"><span class="pre"><span class="Identifier">deadline</span></span></tt> future will not be cancelled and/or failed.</p>
|
|
<p>Note: While <tt class="docutils literal"><span class="pre"><span class="Identifier">waitUntil</span><span class="Punctuation">(</span><span class="Identifier">future</span><span class="Punctuation">)</span></span></tt> operation is pending, please avoid any attempts to cancel future <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt>. If it happens <tt class="docutils literal"><span class="pre"><span class="Identifier">waitUntil</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> could introduce undefined behavior - it could raise<tt class="docutils literal"><span class="pre"><span class="Identifier">CancelledError</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncTimeoutError</span></span></tt>.</p>
|
|
<p>If you need to cancel <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> - cancel <tt class="docutils literal"><span class="pre"><span class="Identifier">waitUntil</span><span class="Punctuation">(</span><span class="Identifier">future</span><span class="Punctuation">)</span></span></tt> instead.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1673"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1673" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="wait,Future[T],int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CFuture%5BT%5D%2Cint"><span class="Identifier">wait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">timeout</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use wait(Future[T], Duration)"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use wait(Future[T], Duration)
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1664"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1664" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="wait,Future[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CFuture%5BT%5D"><span class="Identifier">wait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">timeout</span> <span class="Other">=</span> <span class="Identifier">InfiniteDuration</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Returns a future which will complete once future <tt class="docutils literal"><span class="pre">fut</span></tt> completes or if timeout of <tt class="docutils literal"><span class="pre">timeout</span></tt> milliseconds has been expired.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre">timeout</span></tt> is <tt class="docutils literal"><span class="pre">-1</span></tt>, then statement <tt class="docutils literal"><span class="pre">await wait(fut)</span></tt> is equal to <tt class="docutils literal"><span class="pre">await fut</span></tt>.</p>
|
|
<p>TODO: In case when <tt class="docutils literal"><span class="pre">fut</span></tt> got cancelled, what result Future[T] should return, because it can't be cancelled too.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1647"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1647" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="waitFor,Future[void]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#waitFor%2CFuture%5Bvoid%5D"><span class="Identifier">waitFor</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</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="Identifier">CatchableError</span><span class="Other">]</span><span class="Other">,</span> <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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Blocks the current thread of execution until <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> has finished.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>Must not be called recursively (from inside <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedures).</p>
|
|
<p>See also <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Operator">.</span><span class="Identifier">read</span></span></tt></p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L640"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L640" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="waitFor,InternalRaisesFuture[void,E]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#waitFor%2CInternalRaisesFuture%5Bvoid%2CE%5D"><span class="Identifier">waitFor</span></a><span class="Other">[</span><span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Blocks the current thread of execution until <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> has finished.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>Must not be called recursively (from inside <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedures).</p>
|
|
<p>See also <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Operator">.</span><span class="Identifier">read</span></span></tt></p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1830"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1830" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="waitFor,InternalRaisesFuture[T: not void,E]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#waitFor%2CInternalRaisesFuture%5BT%3A%20not%20void%2CE%5D"><span class="Identifier">waitFor</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">;</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">lent</span> <span class="Identifier">T</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Blocks the current thread of execution until <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> has finished, returning its value.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>Must not be called recursively (from inside <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedures).</p>
|
|
<p>See also <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Operator">.</span><span class="Identifier">read</span></span></tt></p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1818"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1818" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="waitFor,Future[T: not void]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#waitFor%2CFuture%5BT%3A%20not%20void%5D"><span class="Identifier">waitFor</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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="Identifier">lent</span> <span class="Identifier">T</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">CatchableError</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Blocks the current thread of execution until <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span></span></tt> has finished, returning its value.</p>
|
|
<p>If the future failed or was cancelled, the corresponding exception will be raised.</p>
|
|
<p>Must not be called recursively (from inside <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedures).</p>
|
|
<p>See also <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Operator">.</span><span class="Identifier">read</span></span></tt></p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L628"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L628" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="withTimeout,Future[T],Duration">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#withTimeout%2CFuture%5BT%5D%2CDuration"><span class="Identifier">withTimeout</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">timeout</span><span class="Other">:</span> <a href="../timer.html#Duration"><span class="Identifier">Duration</span></a><span class="Other">)</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">bool</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</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">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1447"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1447" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="withTimeout,Future[T],int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#withTimeout%2CFuture%5BT%5D%2Cint"><span class="Identifier">withTimeout</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.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">timeout</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use withTimeout(Future[T], Duration)"</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use withTimeout(Future[T], Duration)
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1522"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1522" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="17">
|
|
<h1><a class="toc-backref" href="#17">Macros</a></h1>
|
|
<dl class="item">
|
|
<div id="internalRaiseIfError.m,FutureBase,typed">
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#internalRaiseIfError.m%2CFutureBase%2Ctyped"><span class="Identifier">internalRaiseIfError</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <span class="Identifier">typed</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L479"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L479" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="internalRaiseIfError.m,InternalRaisesFuture,typed,typed">
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#internalRaiseIfError.m%2CInternalRaisesFuture%2Ctyped%2Ctyped"><span class="Identifier">internalRaiseIfError</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">;</span> <span class="Identifier">raises</span><span class="Other">,</span> <span class="Identifier">info</span><span class="Other">:</span> <span class="Identifier">typed</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L493"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L493" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="18">
|
|
<h1><a class="toc-backref" href="#18">Templates</a></h1>
|
|
<dl class="item">
|
|
<div id="cancel.t,FutureBase">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancel.t%2CFutureBase"><span class="Identifier">cancel</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.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">deprecated</span><span class="Other">:</span> <span class="StringLit">"Please use cancelSoon() or cancelAndWait() instead"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Please use cancelSoon() or cancelAndWait() instead
|
|
</div>
|
|
|
|
Cancel <tt class="docutils literal"><span class="pre">future</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L987"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L987" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelAndSchedule.t,FutureBase">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelAndSchedule.t%2CFutureBase"><span class="Identifier">cancelAndSchedule</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L249"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L249" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelAndWait.t,FutureBase">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelAndWait.t%2CFutureBase"><span class="Identifier">cancelAndWait</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Cancel <tt class="docutils literal"><span class="pre">future</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L1014"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L1014" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelSoon.t,FutureBase">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelSoon.t%2CFutureBase"><span class="Identifier">cancelSoon</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L984"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L984" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelSoon.t,FutureBase,InternalAsyncCallback">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelSoon.t%2CFutureBase%2CInternalAsyncCallback"><span class="Identifier">cancelSoon</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">acb</span><span class="Other">:</span> <a href="asyncengine.html#AsyncCallback"><span class="Identifier">AsyncCallback</span></a><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L981"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L981" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelSoon.t,FutureBase,CallbackFunc">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelSoon.t%2CFutureBase%2CCallbackFunc"><span class="Identifier">cancelSoon</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L978"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L978" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="cancelSoon.t,FutureBase,CallbackFunc,pointer">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#cancelSoon.t%2CFutureBase%2CCallbackFunc%2Cpointer"><span class="Identifier">cancelSoon</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <a href="../futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L975"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L975" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="complete.t,Future[void]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#complete.t%2CFuture%5Bvoid%5D"><span class="Identifier">complete</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Completes a void <tt class="docutils literal"><span class="pre">future</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L211"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L211" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="complete.t,Future[T],T">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#complete.t%2CFuture%5BT%5D%2CT"><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="../futures.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> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Completes <tt class="docutils literal"><span class="pre">future</span></tt> with value <tt class="docutils literal"><span class="pre">val</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L201"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L201" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="fail.t,InternalRaisesFuture[T,E],ref.CatchableError,staticbool">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#fail.t%2CInternalRaisesFuture%5BT%2CE%5D%2Cref.CatchableError%2Cstaticbool"><span class="Identifier">fail</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</span><span class="Other">;</span> <span class="Identifier">warn</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L232"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L232" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="fail.t,Future[T],ref.CatchableError,staticbool">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#fail.t%2CFuture%5BT%5D%2Cref.CatchableError%2Cstaticbool"><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="../futures.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> <span class="Identifier">CatchableError</span><span class="Other">;</span>
|
|
<span class="Identifier">warn</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Completes <tt class="docutils literal"><span class="pre">future</span></tt> with <tt class="docutils literal"><span class="pre">error</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L227"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L227" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Finished.t">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#Finished.t"><span class="Identifier">Finished</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use Completed instead"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use Completed instead
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L74"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L74" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Finished.t,typeFutureState">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#Finished.t%2CtypeFutureState"><span class="Identifier">Finished</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">FutureState</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#FutureState"><span class="Identifier">FutureState</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Use FutureState.Completed instead"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Use FutureState.Completed instead
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L75"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L75" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="LocCompleteIndex.t">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#LocCompleteIndex.t"><span class="Identifier">LocCompleteIndex</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"LocationKind.Finish"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> LocationKind.Finish
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L39"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L39" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="LocCreateIndex.t">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#LocCreateIndex.t"><span class="Identifier">LocCreateIndex</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"LocationKind.Create"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> LocationKind.Create
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L35"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L35" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="LocFinishIndex.t">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#LocFinishIndex.t"><span class="Identifier">LocFinishIndex</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"LocationKind.Finish"</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> LocationKind.Finish
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L37"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L37" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="newFuture.t,static[string],static[FutureFlags]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#newFuture.t%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"><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> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><a href="../futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Creates a new future.</p>
|
|
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</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/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L100"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="newFutureSeq.t,static[string]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#newFutureSeq.t%2Cstatic%5Bstring%5D"><span class="Identifier">newFutureSeq</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">,</span> <span class="Identifier">B</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#FutureSeq"><span class="Identifier">FutureSeq</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">,</span> <span class="Identifier">B</span><span class="Other">]</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated</b>
|
|
</div>
|
|
|
|
<p>Create a new future which can hold/preserve GC sequence until future will not be completed.</p>
|
|
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</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/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L119"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L119" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="newFutureStr.t,static[string]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#newFutureStr.t%2Cstatic%5Bstring%5D"><span class="Identifier">newFutureStr</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="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#FutureStr"><span class="Identifier">FutureStr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated</b>
|
|
</div>
|
|
|
|
<p>Create a new future which can hold/preserve GC string until future will not be completed.</p>
|
|
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</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/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L127"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L127" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="newInternalRaisesFuture.t,static[string]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#newInternalRaisesFuture.t%2Cstatic%5Bstring%5D"><span class="Identifier">newInternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Creates a new future.</p>
|
|
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</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/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L112"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L112" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="orImpl.t,Future[T],Future[Y]">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#orImpl.t%2CFuture%5BT%5D%2CFuture%5BY%5D"><span class="Identifier">orImpl</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="../futures.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="../futures.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> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L739"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L739" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="tryCancel.t,FutureBase">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#tryCancel.t%2CFutureBase"><span class="Identifier">tryCancel</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncfutures.nim#L287"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncfutures.nim#L287" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="19">
|
|
<h1><a class="toc-backref" href="#19">Exports</a></h1>
|
|
<dl class="item">
|
|
<a href="raisesfutures.html#Raising.m,typedesc[Future[T]],typed"><span class="Identifier">Raising</span></a>, <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a>, <a href="raisesfutures.html#init.t,typeInternalRaisesFuture[T,E],static[string],static[FutureFlags]"><span class="Identifier">init</span></a>, <a href="raisesfutures.html#init.t,typeInternalRaisesFuture[T,E],static[string]"><span class="Identifier">init</span></a>, <a href="raisesfutures.html#error,InternalRaisesFuture[T,void]"><span class="Identifier">error</span></a>, <a href="raisesfutures.html#readError,InternalRaisesFuture[T,void]"><span class="Identifier">readError</span></a>
|
|
</dl></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small style="color: var(--hint);">Made with Nim. Generated: 2024-11-28 08:22:46 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|