mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
298 lines
23 KiB
HTML
298 lines
23 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!-- This file is generated by Nim. -->
|
|
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>std/asyncstreams</title>
|
|
|
|
<!-- Google fonts -->
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
|
|
|
<!-- CSS -->
|
|
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
|
|
|
|
<!-- JS -->
|
|
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
|
|
</head>
|
|
<body>
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">std/asyncstreams</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-select-wrapper">
|
|
<label for="theme-select">Theme: </label>
|
|
<select id="theme-select" onchange="setTheme(this.value)">
|
|
<option value="auto">🌗 Match OS</option>
|
|
<option value="dark">🌑 Dark</option>
|
|
<option value="light">🌕 Light</option>
|
|
</select>
|
|
</div>
|
|
<div id="global-links">
|
|
<ul class="simple-boot">
|
|
<li><a href="manual.html">Manual</a></li>
|
|
<li><a href="lib.html">Standard library</a></li>
|
|
<li> <a id="indexLink" href="theindex.html">Index</a></li>
|
|
<li><a href="compiler/theindex.html">Compiler docs</a></li>
|
|
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
|
|
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="search" id="searchInput"
|
|
oninput="search()" />
|
|
</div>
|
|
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
</li>
|
|
<li>
|
|
<details open>
|
|
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#FutureStream" title="FutureStream[T] = ref object
|
|
error*: ref Exception">FutureStream</a></li>
|
|
|
|
</ul>
|
|
</details>
|
|
</li>
|
|
<li>
|
|
<details open>
|
|
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">callback=
|
|
<li><a class="reference" href="#callback%3D%2CFutureStream%5BT%5D%2Cproc%28FutureStream%5BT%5D%29" title="callback=[T](future: FutureStream[T];
|
|
cb: proc (future: FutureStream[T]) {.closure, gcsafe.})">callback=[T](future: FutureStream[T];
|
|
cb: proc (future: FutureStream[T]) {.closure, gcsafe.})</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">complete
|
|
<li><a class="reference" href="#complete%2CFutureStream%5BT%5D" title="complete[T](future: FutureStream[T])">complete[T](future: FutureStream[T])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fail
|
|
<li><a class="reference" href="#fail%2CFutureStream%5BT%5D%2Cref.Exception" title="fail[T](future: FutureStream[T]; error: ref Exception)">fail[T](future: FutureStream[T]; error: ref Exception)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">failed
|
|
<li><a class="reference" href="#failed%2CFutureStream%5BT%5D" title="failed[T](future: FutureStream[T]): bool">failed[T](future: FutureStream[T]): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">finished
|
|
<li><a class="reference" href="#finished%2CFutureStream%5BT%5D" title="finished[T](future: FutureStream[T]): bool">finished[T](future: FutureStream[T]): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">len
|
|
<li><a class="reference" href="#len%2CFutureStream%5BT%5D" title="len[T](future: FutureStream[T]): int">len[T](future: FutureStream[T]): int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newFutureStream
|
|
<li><a class="reference" href="#newFutureStream%2Cstring" title="newFutureStream[T](fromProc = "unspecified"): FutureStream[T]">newFutureStream[T](fromProc = "unspecified"): FutureStream[T]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">read
|
|
<li><a class="reference" href="#read%2CFutureStream%5BT%5D" title="read[T](future: FutureStream[T]): owned(Future[(bool, T)])">read[T](future: FutureStream[T]): owned(Future[(bool, T)])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">write
|
|
<li><a class="reference" href="#write%2CFutureStream%5BT%5D%2CT" title="write[T](future: FutureStream[T]; value: T): Future[void]">write[T](future: FutureStream[T]; value: T): Future[void]</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</details>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L1" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc">Unstable API.</p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="asyncfutures.html">asyncfutures</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="deques.html">deques</a>
|
|
</dl>
|
|
</div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<div id="FutureStream">
|
|
<dt><pre><a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</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="Identifier">error</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a></pre></dt>
|
|
<dd>
|
|
|
|
Special future that acts as a queue. Its API is still experimental and so is subject to change.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L20" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L20" 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="callback=-procs-all">
|
|
<div id="callback=,FutureStream[T],proc(FutureStream[T])">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureStream%5BT%5D%2Cproc%28FutureStream%5BT%5D%29"><span class="Identifier">callback=</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Sets the callback proc to be called when data was placed inside the future stream.</p>
|
|
<p>The callback is also called when the future is completed. So you should use <tt class="docutils literal"><span class="pre"><span class="Identifier">finished</span></span></tt> to check whether data is available.</p>
|
|
<p>If the future stream already has data or is finished then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L60" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L60" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="complete-procs-all">
|
|
<div id="complete,FutureStream[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureStream%5BT%5D"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> signalling the end of data.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L45" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L45" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="fail-procs-all">
|
|
<div id="fail,FutureStream[T],ref.Exception">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#fail%2CFutureStream%5BT%5D%2Cref.Exception"><span class="Identifier">fail</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">error</span></span></tt>.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L52" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L52" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="failed-procs-all">
|
|
<div id="failed,FutureStream[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#failed%2CFutureStream%5BT%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">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
|
|
<dd>
|
|
|
|
Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> completed with an error.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L81" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L81" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="finished-procs-all">
|
|
<div id="finished,FutureStream[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#finished%2CFutureStream%5BT%5D"><span class="Identifier">finished</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="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
|
|
<dd>
|
|
|
|
Check if a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> is finished. <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> value means that no more data will be placed inside the stream <em>and</em> that there is no data waiting to be retrieved.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L75" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L75" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="len-procs-all">
|
|
<div id="len,FutureStream[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CFutureStream%5BT%5D"><span class="Identifier">len</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="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
|
|
<dd>
|
|
|
|
Returns the amount of data pieces inside the stream.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L145" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L145" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="newFutureStream-procs-all">
|
|
<div id="newFutureStream,string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#newFutureStream%2Cstring"><span class="Identifier">newFutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span> <span class="Other">=</span> <span class="StringLit">"unspecified"</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
|
|
<dd>
|
|
|
|
Create a new <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt>. This future's callback is activated when two events occur:<ul class="simple"><li>New data is written into the future stream.</li>
|
|
<li>The future stream is completed (this means that no more data will be written).</li>
|
|
</ul>
|
|
<p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
|
|
<p><strong>Note:</strong> The API of FutureStream is still new and so has a higher likelihood of changing in the future.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L29" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L29" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="read-procs-all">
|
|
<div id="read,FutureStream[T]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CFutureStream%5BT%5D"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</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">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Other">(</span><a href="system.html#bool"><span class="Identifier">bool</span></a><span class="Other">,</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Returns a future that will complete when the <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> has data placed into it. The future will be completed with the oldest value stored inside the stream. The return value will also determine whether data was retrieved, <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> means that the future stream was completed and no data was retrieved.</p>
|
|
<p>This function will remove the data that was returned from the underlying <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt>.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L100" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="write-procs-all">
|
|
<div id="write,FutureStream[T],T">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CFutureStream%5BT%5D%2CT"><span class="Identifier">write</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="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
|
|
<dd>
|
|
|
|
<p>Writes the specified value inside the specified future stream.</p>
|
|
<p>This will raise <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> is finished.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L85" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L85" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</dl>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br>
|
|
<small style="color: var(--hint);">Made with Nim. Generated: 2025-12-28 15:54:44 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
|
|
|
|
</body>
|
|
</html>
|