nim-chronos/api/chronos/futures.html

744 lines
53 KiB
HTML
Raw Normal View History

<?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/futures</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/futures</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>
&nbsp;&nbsp;&nbsp; <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="#CallbackFunc"
title="CallbackFunc = proc (arg: pointer) {.gcsafe, raises: [].}">CallbackFunc</a></li>
<li><a class="reference" href="#CancelledError"
title="CancelledError = object of FutureError">CancelledError</a></li>
<li><a class="reference" href="#Future"
title="Future[T] = ref object of FutureBase
when T isnot void:
internalValue*: T ## Stored value">Future</a></li>
<li><a class="reference" href="#FutureBase"
title="FutureBase = ref object of InternalFutureBase">FutureBase</a></li>
<li><a class="reference" href="#FutureDefect"
title="FutureDefect = object of Defect
cause*: FutureBase">FutureDefect</a></li>
<li><a class="reference" href="#FutureError"
title="FutureError = object of CatchableError
future*: FutureBase">FutureError</a></li>
<li><a class="reference" href="#FutureFlag"
title="FutureFlag {.pure.} = enum
OwnCancelSchedule ## When OwnCancelSchedule is set, the owner of the future is responsible
## for implementing cancellation in one of 3 ways:
##
## * ensure that cancellation requests never reach the future by means of
## not exposing it to user code, `await` and `tryCancel`
## * set `cancelCallback` to `nil` to stop cancellation propagation - this
## is appropriate when it is expected that the future will be completed
## in a regular way &quot;soon&quot;
## * set `cancelCallback` to a handler that implements cancellation in an
## operation-specific way
##
## If `cancelCallback` is not set and the future gets cancelled, a
## `Defect` will be raised.">FutureFlag</a></li>
<li><a class="reference" href="#FutureFlags"
title="FutureFlags = set[FutureFlag]">FutureFlags</a></li>
<li><a class="reference" href="#FutureState"
title="FutureState {.pure.} = enum
Pending, Completed, Cancelled, Failed">FutureState</a></li>
<li><a class="reference" href="#InternalAsyncCallback"
title="InternalAsyncCallback = object
function*: CallbackFunc
udata*: pointer">InternalAsyncCallback</a></li>
<li><a class="reference" href="#InternalFutureBase"
title="InternalFutureBase = object of RootObj
internalLocation*: array[LocationKind, ptr SrcLoc]
internalCallbacks*: seq[InternalAsyncCallback]
internalCancelcb*: CallbackFunc
internalChild*: FutureBase
internalState*: FutureState
internalFlags*: FutureFlags
internalError*: ref CatchableError ## Stored exception
internalClosure*: iterator (f: FutureBase): FutureBase {.raises: [], gcsafe.}
when chronosFutureId:
internalId*: uint
when chronosStackTrace:
internalErrorStackTrace*: StackTrace
internalStackTrace*: StackTrace ## For debugging purposes only.
when chronosFutureTracking:
internalNext*: FutureBase
internalPrev*: FutureBase">InternalFutureBase</a></li>
<li><a class="reference" href="#LocationKind"
title="LocationKind {.pure.} = enum
Create, Finish">LocationKind</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">cancelled
<li><a class="reference" href="#cancelled%2CFutureBase"
title="cancelled(future: FutureBase): bool">cancelled(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">completed
<li><a class="reference" href="#completed%2CFutureBase"
title="completed(future: FutureBase): bool">completed(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">error
<li><a class="reference" href="#error%2CFutureBase"
title="error(future: FutureBase): ref CatchableError">error(future: FutureBase): ref CatchableError</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed%2CFutureBase"
title="failed(future: FutureBase): bool">failed(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">finished
<li><a class="reference" href="#finished%2CFutureBase"
title="finished(future: FutureBase): bool">finished(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">flags
<li><a class="reference" href="#flags%2CFutureBase"
title="flags(future: FutureBase): FutureFlags">flags(future: FutureBase): FutureFlags</a></li>
</ul>
<ul class="simple nested-toc-section">internalInitFutureBase
<li><a class="reference" href="#internalInitFutureBase%2CFutureBase%2Cptr.SrcLoc%2CFutureState%2CFutureFlags"
title="internalInitFutureBase(fut: FutureBase; loc: ptr SrcLoc; state: FutureState;
flags: FutureFlags)">internalInitFutureBase(fut: FutureBase; loc: ptr SrcLoc; state: FutureState;
flags: FutureFlags)</a></li>
</ul>
<ul class="simple nested-toc-section">location
<li><a class="reference" href="#location%2CFutureBase"
title="location(future: FutureBase): array[LocationKind, ptr SrcLoc]">location(future: FutureBase): array[LocationKind, ptr SrcLoc]</a></li>
</ul>
<ul class="simple nested-toc-section">state
<li><a class="reference" href="#state%2CFutureBase"
title="state(future: FutureBase): FutureState">state(future: FutureBase): FutureState</a></li>
</ul>
<ul class="simple nested-toc-section">value
<li><a class="reference" href="#value%2CFuture%5Bvoid%5D"
title="value(future: Future[void])">value(future: Future[void])</a></li>
<li><a class="reference" href="#value%2CFuture%5BT%3A%20not%20void%5D"
title="value[T: not void](future: Future[T]): lent T">value[T: not void](future: Future[T]): lent T</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">completed
<li><a class="reference" href="#completed.t%2CtypeFuture%2Cstatic%5Bstring%5D"
title="completed(F: type Future; fromProc: static[string] = &quot;&quot;): Future[void]">completed(F: type Future; fromProc: static[string] = &quot;&quot;): Future[void]</a></li>
<li><a class="reference" href="#completed.t%2CtypeFuture%2CT%2Cstatic%5Bstring%5D"
title="completed[T: not void](F: type Future; valueParam: T;
fromProc: static[string] = &quot;&quot;): Future[T]">completed[T: not void](F: type Future; valueParam: T;
fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed.t%2CtypeFuture%5BT%5D%2Cref.CatchableError%2Cstatic%5Bstring%5D"
title="failed[T](F: type Future[T]; errorParam: ref CatchableError;
fromProc: static[string] = &quot;&quot;): Future[T]">failed[T](F: type Future[T]; errorParam: ref CatchableError;
fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
</ul>
<ul class="simple nested-toc-section">id
<li><a class="reference" href="#id.t%2CFutureBase"
title="id(fut: FutureBase): uint">id(fut: FutureBase): uint</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D"
title="init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;): Future[T]">init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
<li><a class="reference" href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"
title="init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): Future[T]">init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): Future[T]</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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="config.html">config</a>, <a class="reference external" href="srcloc.html">srcloc</a>
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="CallbackFunc">
<dt><pre><a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">arg</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">gcsafe</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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L25"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L25" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="CancelledError">
<dt><pre><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</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>
Exception raised when accessing the value of a cancelled future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L91"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L91" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="Future">
<dt><pre><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="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
<span class="Keyword">when</span> <span class="Identifier">T</span> <span class="Keyword">isnot</span> <span class="Identifier">void</span><span class="Other">:</span>
<span class="Identifier">internalValue</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">T</span> <span class="Comment">## Stored value</span>
</pre></dt>
<dd>
Typed future.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L81"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L81" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureBase">
<dt><pre><a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="futures.html#InternalFutureBase"><span class="Identifier">InternalFutureBase</span></a>
</pre></dt>
<dd>
Untyped Future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L78"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L78" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureDefect">
<dt><pre><a href="futures.html#FutureDefect"><span class="Identifier">FutureDefect</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">Defect</span>
<span class="Identifier">cause</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L85"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L85" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureError">
<dt><pre><a href="futures.html#FutureError"><span class="Identifier">FutureError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">CatchableError</span>
<span class="Identifier">future</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L88"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L88" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureFlag">
<dt><pre><a href="futures.html#FutureFlag"><span class="Identifier">FutureFlag</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">OwnCancelSchedule</span> <span class="Comment">## When OwnCancelSchedule is set, the owner of the future is responsible</span>
<span class="Comment">## for implementing cancellation in one of 3 ways:</span>
<span class="Comment">## </span>
<span class="Comment">## * ensure that cancellation requests never reach the future by means of</span>
<span class="Comment">## not exposing it to user code, `await` and `tryCancel`</span>
<span class="Comment">## * set `cancelCallback` to `nil` to stop cancellation propagation - this</span>
<span class="Comment">## is appropriate when it is expected that the future will be completed</span>
<span class="Comment">## in a regular way &quot;soon&quot;</span>
<span class="Comment">## * set `cancelCallback` to a handler that implements cancellation in an</span>
<span class="Comment">## operation-specific way</span>
<span class="Comment">## </span>
<span class="Comment">## If `cancelCallback` is not set and the future gets cancelled, a</span>
<span class="Comment">## `Defect` will be raised.</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L35"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L35" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureFlags">
<dt><pre><a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a> <span class="Other">=</span> <span class="Identifier">set</span><span class="Other">[</span><a href="futures.html#FutureFlag"><span class="Identifier">FutureFlag</span></a><span class="Other">]</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L51"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L51" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureState">
<dt><pre><a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Pending</span><span class="Other">,</span> <span class="Identifier">Completed</span><span class="Other">,</span> <span class="Identifier">Cancelled</span><span class="Other">,</span> <span class="Identifier">Failed</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L32"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L32" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="InternalAsyncCallback">
<dt><pre><a href="futures.html#InternalAsyncCallback"><span class="Identifier">InternalAsyncCallback</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">function</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a>
<span class="Identifier">udata</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">pointer</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L28"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L28" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="InternalFutureBase">
<dt><pre><a href="futures.html#InternalFutureBase"><span class="Identifier">InternalFutureBase</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">internalLocation</span><span class="Operator">*</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="Identifier">internalCallbacks</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#InternalAsyncCallback"><span class="Identifier">InternalAsyncCallback</span></a><span class="Other">]</span>
<span class="Identifier">internalCancelcb</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a>
<span class="Identifier">internalChild</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
<span class="Identifier">internalState</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a>
<span class="Identifier">internalFlags</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a>
<span class="Identifier">internalError</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</span> <span class="Comment">## Stored exception</span>
<span class="Identifier">internalClosure</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">iterator</span> <span class="Other">(</span><span class="Identifier">f</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#FutureBase"><span class="Identifier">FutureBase</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span></span>.}
<span class="Keyword">when</span> <span class="Identifier">chronosFutureId</span><span class="Other">:</span>
<span class="Identifier">internalId</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint</span>
<span class="Keyword">when</span> <span class="Identifier">chronosStackTrace</span><span class="Other">:</span>
<span class="Identifier">internalErrorStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">StackTrace</span>
<span class="Identifier">internalStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">StackTrace</span> <span class="Comment">## For debugging purposes only.</span>
<span class="Keyword">when</span> <span class="Identifier">chronosFutureTracking</span><span class="Other">:</span>
<span class="Identifier">internalNext</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">FutureBase</span>
<span class="Identifier">internalPrev</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">FutureBase</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L53"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L53" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="LocationKind">
<dt><pre><a href="futures.html#LocationKind"><span class="Identifier">LocationKind</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Create</span><span class="Other">,</span> <span class="Identifier">Finish</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L21"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L21" 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="cancelled,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#cancelled%2CFutureBase"><span class="Identifier">cancelled</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 class="Identifier">inline</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>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> has cancelled.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L210"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L210" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="completed,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#completed%2CFutureBase"><span class="Identifier">completed</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 class="Identifier">inline</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>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> finished with a value.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L218"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L218" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="error,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#error%2CFutureBase"><span class="Identifier">error</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="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><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>Return the error of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>, or <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> if future did not fail.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">readError</span></span></tt> for a version that raises a catchable error when the future has not failed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L247"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L247" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="failed,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#failed%2CFutureBase"><span class="Identifier">failed</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</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>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> finished with an error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L214"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L214" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="finished,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#finished%2CFutureBase"><span class="Identifier">finished</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 class="Identifier">inline</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>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> has finished, i.e. <tt class="docutils literal"><span class="pre">future</span></tt> state changed from state <tt class="docutils literal"><span class="pre">Pending</span></tt> to one of the states (<tt class="docutils literal"><span class="pre">Finished</span></tt>, <tt class="docutils literal"><span class="pre">Cancelled</span></tt>, <tt class="docutils literal"><span class="pre">Failed</span></tt>).
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L204"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L204" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="flags,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#flags%2CFutureBase"><span class="Identifier">flags</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#FutureFlags"><span class="Identifier">FutureFlags</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L201"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L201" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="internalInitFutureBase,FutureBase,ptr.SrcLoc,FutureState,FutureFlags">
<dt><pre><span class="Keyword">proc</span> <a href="#internalInitFutureBase%2CFutureBase%2Cptr.SrcLoc%2CFutureState%2CFutureFlags"><span class="Identifier">internalInitFutureBase</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">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="Identifier">state</span><span class="Other">:</span> <a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L115"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L115" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="location,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#location%2CFutureBase"><span class="Identifier">location</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">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><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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L222"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L222" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="state,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#state%2CFutureBase"><span class="Identifier">state</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#FutureState"><span class="Identifier">FutureState</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L198"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L198" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="value,Future[void]">
<dt><pre><span class="Keyword">func</span> <a href="#value%2CFuture%5Bvoid%5D"><span class="Identifier">value</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="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return the value in a completed future - raises Defect when <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span><span class="Operator">.</span><span class="Identifier">completed</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt> for a version that raises a catchable error when future has not completed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L237"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L237" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="value,Future[T: not void]">
<dt><pre><span class="Keyword">func</span> <a href="#value%2CFuture%5BT%3A%20not%20void%5D"><span class="Identifier">value</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">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="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="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return the value in a completed future - raises Defect when <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span><span class="Operator">.</span><span class="Identifier">completed</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt> for a version that raises a catchable error when future has not completed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L225"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L225" 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="completed.t,typeFuture,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#completed.t%2CtypeFuture%2Cstatic%5Bstring%5D"><span class="Identifier">completed</span></a><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">Future</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">&quot;&quot;</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></pre></dt>
<dd>
Create a new completed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L168"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L168" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="completed.t,typeFuture,T,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#completed.t%2CtypeFuture%2CT%2Cstatic%5Bstring%5D"><span class="Identifier">completed</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">F</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">Future</span><span class="Other">;</span> <span class="Identifier">valueParam</span><span class="Other">:</span> <span class="Identifier">T</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">&quot;&quot;</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></pre></dt>
<dd>
Create a new completed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L176"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L176" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="failed.t,typeFuture[T],ref.CatchableError,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#failed.t%2CtypeFuture%5BT%5D%2Cref.CatchableError%2Cstatic%5Bstring%5D"><span class="Identifier">failed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</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">errorParam</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</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">&quot;&quot;</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></pre></dt>
<dd>
Create a new failed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L184"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L184" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="id.t,FutureBase">
<dt><pre><span class="Keyword">template</span> <a href="#id.t%2CFutureBase"><span class="Identifier">id</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="Identifier">uint</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L102"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L102" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init.t,typeFuture[T],static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</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">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">&quot;&quot;</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></pre></dt>
<dd>
<p>Creates a new pending 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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L148"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L148" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init.t,typeFuture[T],static[string],static[FutureFlags]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</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">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">&quot;&quot;</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> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Creates a new pending 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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L157"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L157" 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="srcloc.html#$,ptr.SrcLoc"><span class="Identifier">$</span></a>, <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a>, <a href="srcloc.html#getSrcLocation.t,staticstring"><span class="Identifier">getSrcLocation</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>