mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 08:46:44 +08:00
217 lines
30 KiB
HTML
217 lines
30 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8" />
|
|
<title>Changelog | Continuable</title>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
<link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
<link rel="stylesheet" href="base.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
<link rel="stylesheet" href="terminal.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
<link rel="stylesheet" href="atom-one-dark.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="theme-color" content="#23373B" />
|
|
</head>
|
|
<body>
|
|
<header><nav id="navigation">
|
|
<div class="m-container">
|
|
<div class="m-row">
|
|
<a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">Continuable <span class="m-thin">4.1.0</span></a>
|
|
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
|
|
<a href="#search" class="m-dox-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
|
|
<path d="m6 0c-3.3144 0-6 2.6856-6 6 0 3.3144 2.6856 6 6 6 1.4858 0 2.8463-0.54083 3.8945-1.4355-0.0164 0.33797 0.14734 0.75854 0.5 1.1504l3.2227 3.7891c0.55185 0.6139 1.4517 0.66544 2.002 0.11524 0.55022-0.55022 0.49866-1.4501-0.11524-2.002l-3.7891-3.2246c-0.39184-0.35266-0.81242-0.51469-1.1504-0.5 0.89472-1.0482 1.4355-2.4088 1.4355-3.8945 0-3.3128-2.6856-5.998-6-5.998zm0 1.5625a4.4375 4.4375 0 0 1 4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375-4.4375 4.4375 4.4375 0 0 1 4.4375-4.4375z"/>
|
|
</svg></a>
|
|
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
|
|
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
|
|
</div>
|
|
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
|
|
<div class="m-row">
|
|
<ol class="m-col-t-6 m-col-m-none">
|
|
<li>
|
|
<a href="tutorial.html">Tutorial</a>
|
|
<ol>
|
|
<li><a href="tutorial-creating-continuables.html">Creating continuables</a></li>
|
|
<li><a href="tutorial-chaining-continuables.html">Chaining continuables</a></li>
|
|
<li><a href="tutorial-connecting-continuables.html">Connecting continuables</a></li>
|
|
<li><a href="tutorial-transforming-continuables.html">Transforming continuables</a></li>
|
|
<li><a href="tutorial-awaiting-continuables.html">Awaiting continuables</a></li>
|
|
<li><a href="tutorial-promisify-continuables.html">Promisify functions</a></li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<a href="pages.html">Pages</a>
|
|
<ol>
|
|
<li><a href="installation.html">Installation</a></li>
|
|
<li><a href="tutorial.html">Tutorial</a></li>
|
|
<li><a href="configuration.html">Configuration</a></li>
|
|
<li><a href="changelog.html" id="m-navbar-current">Changelog</a></li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<a href="modules.html">Modules</a>
|
|
<ol>
|
|
<li><a href="group___base.html">Base</a></li>
|
|
<li><a href="group___connections.html">Connections</a></li>
|
|
<li><a href="group___promisify.html">Promisify</a></li>
|
|
<li><a href="group___testing.html">Testing</a></li>
|
|
<li><a href="group___types.html">Types</a></li>
|
|
<li><a href="group___transforms.html">Transforms</a></li>
|
|
<li><a href="group___traversal.html">Traversal</a></li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
<ol class="m-col-t-6 m-col-m-none" start="4">
|
|
<li>
|
|
<a href="namespacecti.html">cti</a>
|
|
<ol>
|
|
<li><a href="namespacecti_1_1transforms.html">cti::transforms</a></li>
|
|
<li><a href="classcti_1_1continuable__base.html">cti::continuable_base</a></li>
|
|
<li><a href="classcti_1_1promise__base.html">cti::promise_base</a></li>
|
|
</ol>
|
|
</li>
|
|
<li class="m-show-m"><a href="#search" class="m-dox-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
|
|
<path d="m6 0c-3.3144 0-6 2.6856-6 6 0 3.3144 2.6856 6 6 6 1.4858 0 2.8463-0.54083 3.8945-1.4355-0.0164 0.33797 0.14734 0.75854 0.5 1.1504l3.2227 3.7891c0.55185 0.6139 1.4517 0.66544 2.002 0.11524 0.55022-0.55022 0.49866-1.4501-0.11524-2.002l-3.7891-3.2246c-0.39184-0.35266-0.81242-0.51469-1.1504-0.5 0.89472-1.0482 1.4355-2.4088 1.4355-3.8945 0-3.3128-2.6856-5.998-6-5.998zm0 1.5625a4.4375 4.4375 0 0 1 4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375-4.4375 4.4375 4.4375 0 0 1 4.4375-4.4375z"/>
|
|
</svg> Search</a></li>
|
|
</ol>
|
|
<ol class="m-col-t-6 m-col-m-none">
|
|
<li>
|
|
<a href="https://github.com/Naios/continuable" aria-label="View source on Github"><i class="fa fa-github"></i> Code</a>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav></header>
|
|
<main><article>
|
|
<div class="m-container m-container-inflatable">
|
|
<div class="m-row">
|
|
<div class="m-col-l-10 m-push-l-1">
|
|
<h1>
|
|
Changelog
|
|
</h1>
|
|
|
|
<p>A description of the changes made to continuable.</p>
|
|
<section id="changelog-versions"><h2><a href="#changelog-versions">Versions</a></h2><p>Following versions were released:</p><section id="changelog-versions-4-0-0"><h3><a href="#changelog-versions-4-0-0">4.0.0</a></h3><p>Various issues have been resolved:</p><ul><li><a href="https://github.com/Naios/continuable/issues/27">#27: First class, zero-overhead ASIO integration</a></li><li><a href="https://github.com/Naios/continuable/issues/23">#23: VS 16.2: parameter pack must be expanded in this context</a></li><li><a href="https://github.com/Naios/continuable/issues/21">#21: Infinite recursion during compilation</a></li><li><a href="https://github.com/Naios/continuable/issues/16">#16: Add AppleClang compiler to cmake</a></li><li><a href="https://github.com/Naios/continuable/issues/13">#13: unit-test/test-continuable-single fails on gcc 8.2</a></li><li><a href="https://github.com/Naios/continuable/issues/11">#11: Forward declarations are no longer allowed in type-erased continuables</a></li></ul><p>Following methods and functions have been added:</p><p><strong>Various improvements to <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>:</strong></p><ul><li><a href="classcti_1_1continuable__base.html#af20fda227275f3c3492b5965e523278a" class="m-dox">continuable_base::<wbr />as</a> for casting to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with different arguments</li><li><a href="classcti_1_1continuable__base.html#a1683400fcf7e5b0df8c236396bad6198" class="m-dox">continuable_base::<wbr />finish</a> for 'materializing' an intermediate chained <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a></li></ul><p><strong>An asychronous initiation function comparable to std::async:</strong></p><p>The asynchronous facilities make it possible now to start with a handler instead of a continuation:</p><pre class="m-code"><span class="n">async</span><span class="p">([]</span> <span class="p">{</span>
|
|
<span class="c1">// ...</span>
|
|
<span class="p">}).</span><span class="n">then</span><span class="p">(...);</span></pre><ul><li><a href="group___operations.html#ga4ce261e5088a6c0090e4d8d40b5ab400" class="m-dox">async</a> Makes it possible to start with a handler instead of a continuation, comparable to <code>std::async</code></li><li><a href="group___operations.html#ga7d7b91994b174a0652d5f81d4872533f" class="m-dox">async_<wbr />on</a> allows to specify an additional executor parameter</li></ul><p><strong>The result class and modifying the asynchronous control flow</strong></p><p>Every continuation handler used in <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then</a>, <a href="classcti_1_1continuable__base.html#ad4960d0794abb800f1dfd9a668900149" class="m-dox">continuable_base::<wbr />next</a> and <a href="classcti_1_1continuable__base.html#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">continuable_base::<wbr />fail</a> allows now to return a <a href="classcti_1_1result.html" class="m-dox">result</a> which represents the asynchronous result.</p><p>This allows recovering from failures or throwing of exception types from handlers when exceptions are disabled.</p><p>Result handling and</p><ul><li><a href="classcti_1_1result.html" class="m-dox">result</a></li><li><a href="group___base.html#ga9223cf1a04ca2d6950d83d0917192fa5" class="m-dox">rethrow</a> Throws an exception or error code from a result or failure handler</li><li><a href="group___base.html#ga3c1710e55aab586d267f96a02f6cd014" class="m-dox">cancel</a> Throws a default constructed exception type or error code from a result or failure handler to signal cancellation.</li><li><a href="group___base.html#gac20d32604949856659f84c06ebcaeb9e" class="m-dox">stop</a> Can be used to stop an asynchronous continuation chain, no handler which comes after stop was received won't be called.</li><li><a href="group___result.html#ga2852fa60e4e34409e35a9f6e8ff5c816" class="m-dox">make_<wbr />result</a> Creates a present result from the given values.</li></ul><p>Special result types</p><ul><li><a href="structcti_1_1empty__result.html" class="m-dox">empty_<wbr />result</a> A class which is convertible to any <a href="classcti_1_1result.html" class="m-dox">result</a> and that definitely holds no value so the real result gets invalidated when this object is passed to it.</li><li><a href="structcti_1_1cancellation__result.html" class="m-dox">cancellation_<wbr />result</a> A class which is convertible to any <a href="classcti_1_1result.html" class="m-dox">result</a> and that definitely holds a default constructed exception which signals the cancellation of the asynchronous control flow.</li><li><a href="classcti_1_1exceptional__result.html" class="m-dox">exceptional_<wbr />result</a> A class which is convertible to any result and that holds an exception which is then passed to the converted result object.</li></ul><p><strong>Optimize 'ready' continuables:</strong></p><p>Continuables which are 'ready' and side effect free can now be unpacked synchronously. Mainly such continuables are created through <a href="group___base.html#gaa1b6bcf17649b137e29c866ced3569c7" class="m-dox">make_<wbr />ready_<wbr />continuable</a>, <a href="group___base.html#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_<wbr />exceptional_<wbr />continuable</a> and <a href="group___base.html#ga7f0646a26ba7ee4ce1ac42caeef3caa1" class="m-dox">make_<wbr />cancelling_<wbr />continuable</a>.</p><ul><li><a href="classcti_1_1continuable__base.html#addf07360b93670a5105ae9d69062993e" class="m-dox">continuable_base::<wbr />is_ready</a> Returns true when the continuable can provide its result immediately, and its lazy invocation would be side-effect free.</li><li><a href="classcti_1_1continuable__base.html#a7425eec5c30a65707f92e6d0017e21ed" class="m-dox">continuable_base::<wbr />unpack</a> Invalidates the continuable and returns its immediate invocation result.</li><li><a href="group___base.html#ga7f0646a26ba7ee4ce1ac42caeef3caa1" class="m-dox">make_<wbr />cancelling_<wbr />continuable</a> Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with the parameterized result which never resolves its promise and thus cancels the asynchronous continuation chain through throwing a default constructed exception_t.</li></ul><p>Including various helper tags for the underlying changed continuation object structure:</p><ul><li><a href="group___primitives.html#ga0471bc4c43101c3f077c0601c617abce" class="m-dox">signature_<wbr />arg_<wbr />t</a></li><li><a href="structcti_1_1is__ready__arg__t.html" class="m-dox">is_<wbr />ready_<wbr />arg_<wbr />t</a></li><li><a href="structcti_1_1unpack__arg__t.html" class="m-dox">unpack_<wbr />arg_<wbr />t</a></li><li><a href="structcti_1_1exception__arg__t.html" class="m-dox">exception_<wbr />arg_<wbr />t</a></li><li><a href="group___primitives.html#ga9fa0d3597f70a7b9e763639f0b30dee1" class="m-dox">exception_<wbr />t</a></li></ul><p><strong>asio asynchronous initiate token:</strong></p><p>The <a href="structcti_1_1use__continuable__t.html" class="m-dox">use_<wbr />continuable_<wbr />t</a> special tag can be used to make (boost) asio return a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p><ul><li><a href="namespacecti.html#a0e7f3cb9a77364e61bb38b13007ee10f" class="m-dox">use_<wbr />continuable</a> Type used as an ASIO completion token to specify an asynchronous operation that should return a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</li></ul><pre class="m-code"><span class="cp">#include</span> <span class="cpf"><continuable/continuable.hpp></span><span class="cp"></span>
|
|
<span class="cp">#include</span> <span class="cpf"><continuable/external/asio.hpp></span><span class="cp"></span>
|
|
<span class="cp">#include</span> <span class="cpf"><asio.hpp></span><span class="cp"></span>
|
|
|
|
<span class="c1">// ...</span>
|
|
|
|
<span class="n">asio</span><span class="o">::</span><span class="n">tcp</span><span class="o">::</span><span class="n">resolver</span> <span class="n">resolver</span><span class="p">(...);</span>
|
|
<span class="n">resolver</span><span class="p">.</span><span class="n">async_resolve</span><span class="p">(</span><span class="s">"127.0.0.1"</span><span class="p">,</span> <span class="s">"daytime"</span><span class="p">,</span> <span class="n">cti</span><span class="o">::</span><span class="n">use_continuable</span><span class="p">)</span>
|
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">asio</span><span class="o">::</span><span class="n">udp</span><span class="o">::</span><span class="n">resolver</span><span class="o">::</span><span class="n">iterator</span> <span class="n">iterator</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="c1">// ...</span>
|
|
<span class="p">});</span></pre><p><strong>Iterating over an asynchronous control flow:</strong></p><p>The loop function was added which makes is possible to emulate an asynchronous loop, that is comparable to a <code>co_await</code> with <code>for</code>.</p><ul><li><a href="group___operations.html#ga41b7be8d042ecbdbd264ca2ca207fdbb" class="m-dox">loop</a></li><li><a href="namespacecti.html#af59633b4e1155dc471865ef273732a33" class="m-dox">loop_<wbr />result</a> Can be used to indicate a specific result inside an asynchronous loop.</li><li><a href="namespacecti.html#acb5eef7e3480100b3d86a2eeca3f7863" class="m-dox">loop_<wbr />break</a> Can be used to create a loop_result which causes the loop to be cancelled and resolved with the given arguments.</li><li><a href="namespacecti.html#af64bd365870206d2cbcadd9166d4f294" class="m-dox">loop_<wbr />continue</a> Can be used to create a loop_result which causes the loop to be repeated.</li><li><a href="namespacecti.html#ade074981d56d8c64388ad05cbd0d20f7" class="m-dox">range_<wbr />loop</a> Can be used to create an asynchronous loop over a specific range.</li><li><a href="namespacecti.html#ade074981d56d8c64388ad05cbd0d20f7" class="m-dox">range_<wbr />loop</a> Can be used to create an asynchronous loop over a specific range.</li><li><a href="group___primitives.html#gadd542364566ec6cc22a4b92c47889443" class="m-dox">plain_<wbr />t</a> Represents the type that is used to disable the special meaning of types which are returned by a asynchronous result handler. See cti::plain for details.</li><li><a href="group___base.html#gacc7ae86f30e3c0331861ce7871e310dd" class="m-dox">make_<wbr />plain</a> Can be used to disable the special meaning for a returned value in asynchronous handler functions.</li></ul><p><strong>Synchronous wait transforms:</strong></p><p>The wait transforms allows to block the current thread until a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was resolved.</p><ul><li><a href="namespacecti_1_1transforms.html#a087d7b1c359b9f7d4a89d201d8493416" class="m-dox">transforms::<wbr />wait</a> Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.</li><li><a href="namespacecti_1_1transforms.html#a46d91cdd1e5153ca4a7f42fda616dd34" class="m-dox">transforms::<wbr />wait_for</a> Same as <a href="namespacecti_1_1transforms.html#a087d7b1c359b9f7d4a89d201d8493416" class="m-dox">transforms::<wbr />wait</a> wich waits for a given duration</li><li><a href="namespacecti_1_1transforms.html#aad924bf66494a6bb199192d7af2b8aea" class="m-dox">transforms::<wbr />wait_until</a> Same as <a href="namespacecti_1_1transforms.html#a087d7b1c359b9f7d4a89d201d8493416" class="m-dox">transforms::<wbr />wait</a> wich waits until a given timepoint</li></ul><p><strong>Various changes:</strong></p><p>Many more unlisted changes including:</p><ul><li><a href="group___types.html#ga95694d77afbef8b5a715b9e715ffdeb9" class="m-dox">work</a> Defines a non-copyable type erasure which is capable of carrying callable objects passed to executors.</li><li><a href="group___types.html#ga4e33254143db6484c753a19662f933aa" class="m-dox">continuation_<wbr />capacity</a></li><li><a href="classcti_1_1promisify.html#a544cd0fd6e3466b9c3c45079803d6b84" class="m-dox">promisify::<wbr />with</a></li><li><a href="group___result.html#gaa4a7d06dc54b9058d15bf46305e4f282" class="m-dox">void_<wbr />arg_<wbr />t</a></li></ul><p>Additional various bugfixes have been made.</p></section><section id="changelog-versions-3-0-0"><h3><a href="#changelog-versions-3-0-0">3.0.0</a></h3><p><strong>New helper functions</strong></p><p>New helper functions were added to create ready continuables:</p><ul><li><a href="group___base.html#gaa1b6bcf17649b137e29c866ced3569c7" class="m-dox">make_<wbr />ready_<wbr />continuable</a> Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with no result which instantly resolves the promise with no values.</li><li><a href="group___base.html#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_<wbr />exceptional_<wbr />continuable</a> Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with the parameterized result which instantly resolves the promise with the given error type.</li></ul><p><strong>Improvements to connections</strong></p><p>The implementation of connections were rewritten entirely. It is possible now to connect runtime sized containers as well as deeply nested sequences. See <a href="tutorial-connecting-continuables.html" class="m-dox">Connecting continuables</a> for details.</p><p>Additionally connection overloads were added that accept two iterators in order to come closer to the interface of the standard library.</p><p>Also <a href="group___connections.html#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox">populate</a> was added which makes it possible to populate a dynamic container from <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p><p><strong>Disabled copies for promises and continuables entirely</strong></p><p>The <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> and <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is now non copyable. This change should make it easier to work with the move only semantic of continuables in order to make less mistakes.</p><p><strong>Traversal API</strong></p><p>A new traversal API for synchronous and asynchronous pack traversal was added which makes it easy to specify new connection types.</p></section><section id="changelog-versions-2-0-0"><h3><a href="#changelog-versions-2-0-0">2.0.0</a></h3><p><strong>Error handling</strong></p><p>Usually it is inconvenient to handle error codes and exceptions in an asynchronous context, as we all know <code>std::future</code> supports error handling through exceptions already. We now introduce this capability to the continuable library while allowing error codes to be used as well.</p><p>Consider the function <code><a href="group___types.html#ga95d2328ba27fe194491b52073b58be50" class="m-dox">cti::<wbr />continuable</a><> get_bad_continuable()</code> which always resolves through an error, then you may handle the error code or exception as following:</p><pre class="m-code"><span class="n">get_bad_continuable</span><span class="p">()</span>
|
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
|
<span class="c1">// ... never invoked</span>
|
|
<span class="p">})</span>
|
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
|
<span class="c1">// ... never invoked as well</span>
|
|
<span class="p">})</span>
|
|
<span class="p">.</span><span class="n">fail</span><span class="p">([]</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception_ptr</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="k">try</span> <span class="p">{</span>
|
|
<span class="n">std</span><span class="o">::</span><span class="n">rethrow_exception</span><span class="p">(</span><span class="n">e</span><span class="p">);</span>
|
|
<span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span> <span class="k">const</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="c1">// Handle the exception here</span>
|
|
<span class="p">}</span>
|
|
<span class="p">});</span></pre><p><strong>Abstracting callbacks as promises</strong></p><p>Since a callback may be called through an error or result the cri::promise class was added in order ro provide a similar interface to std::promise:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">http_request</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">(</span>
|
|
<span class="p">[</span><span class="n">url</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">url</span><span class="p">)](</span><span class="n">cti</span><span class="o">::</span><span class="n">promise</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="c1">// Perform the actual request through a different library,</span>
|
|
<span class="c1">// resolve the promise upon completion of the task.</span>
|
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">"<html> ... </html>"</span><span class="p">);</span>
|
|
<span class="c1">// ...or promise.set_exception(...);</span>
|
|
<span class="p">});</span>
|
|
<span class="p">}</span></pre><p><strong><code>co_await</code> support</strong></p><p>Experimental coroutine (<code>co_await</code> and <code>co_return</code>) support was added, this is available on MSVC 2017 and Clang 5.0.</p><pre class="m-code"><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
|
<span class="p">});</span></pre><p><strong>Minor improvements</strong></p><p>The library was improved in other ways:</p><ul><li><code>constexpr</code> and <code>noexcept</code> improvements</li><li>Compile-time improvements</li><li>Documentation improvements</li></ul><p><strong>Header split</strong></p><p>Since the overall library size was increased the headers were split into smaller chunks.</p></section><section id="changelog-versions-1-0-0"><h3><a href="#changelog-versions-1-0-0">1.0.0</a></h3><ul><li>Documentation and readme changes</li><li>Change the assertion type of some GTest macros from expected to assertion.</li></ul></section><section id="changelog-versions-0-8-0"><h3><a href="#changelog-versions-0-8-0">0.8.0 (unstable)</a></h3><ul><li>Fixes a major issue with handling the ownership for consumed continuables which led to unintended invocations.</li><li><p>Adds partial application support which makes it possible to chain callbacks which accept less arguments then the curret signature.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
|
<span class="c1">// ...</span>
|
|
<span class="p">});</span></pre></li><li><p>Adds Support for sequential invocation:</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">>></span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">)</span>
|
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
|
<span class="c1">// ...</span>
|
|
<span class="p">});</span></pre></li></ul></section><section id="changelog-versions-0-7-0"><h3><a href="#changelog-versions-0-7-0">0.7.0 (unstable)</a></h3><ul><li>Continuation syntactic sugar</li><li>Executor support</li><li>Connection support</li></ul></section></section><section id="changelog-semver"><h2><a href="#changelog-semver">Semantic versioning and stability</a></h2><p>Continuable strictly follows the rules of <a href="http://semver.org/">semantic versioning</a>, the API is kept stable across minor versions.</p><p>The CI driven unit-tests are observed through the Clang sanitizers (asan, ubsan and lsan - when compiling with Clang) or Valgrind (when compiling with GCC) in order to prevent regressions.</p></section>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article></main>
|
|
<div class="m-dox-search" id="search">
|
|
<a href="#!" onclick="return hideSearch()"></a>
|
|
<div class="m-container">
|
|
<div class="m-row">
|
|
<div class="m-col-m-8 m-push-m-2">
|
|
<div class="m-dox-search-header m-text m-small">
|
|
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
|
|
<div id="search-symbolcount">…</div>
|
|
</div>
|
|
<div class="m-dox-search-content">
|
|
<form>
|
|
<input type="search" name="q" id="search-input" placeholder="Loading …" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
|
|
</form>
|
|
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
|
|
<div id="search-help" class="m-text m-dim m-text-center">
|
|
<p class="m-noindent">Search for symbols, directories, files, pages or
|
|
modules. You can omit any prefix from the symbol or file path; adding a
|
|
<code>:</code> or <code>/</code> suffix lists all members of given symbol or
|
|
directory.</p>
|
|
<p class="m-noindent">Use <span class="m-label m-dim">↓</span>
|
|
/ <span class="m-label m-dim">↑</span> to navigate through the list,
|
|
<span class="m-label m-dim">Enter</span> to go.
|
|
<span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
|
|
copy a link to the result using <span class="m-label m-dim">⌘</span>
|
|
<span class="m-label m-dim">L</span> while <span class="m-label m-dim">⌘</span>
|
|
<span class="m-label m-dim">M</span> produces a Markdown link.</p>
|
|
|
|
</div>
|
|
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
|
|
<ul id="search-results"></ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="search.js"></script>
|
|
<script src="searchdata.js" async="async"></script>
|
|
<footer><nav>
|
|
<div class="m-container">
|
|
<div class="m-row">
|
|
<div class="m-col-l-10 m-push-l-1">
|
|
<b><a
|
|
href="https://github.com/Naios/continuable">continuable</a></b>
|
|
-
|
|
C++14
|
|
allocation
|
|
aware
|
|
futures</br>Copyright
|
|
2015–2020
|
|
<a
|
|
href="https://github.com/Naios">Denis
|
|
Blank</a>.
|
|
Contact
|
|
the
|
|
author
|
|
via
|
|
<a
|
|
href="mailto:denis.blank@outlook.com">e-mail</a>.</br>Powered
|
|
by
|
|
<a
|
|
href="http://doxygen.org/">Doxygen</a>
|
|
and
|
|
<a
|
|
href="http://mcss.mosra.cz/">m.css</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav></footer>
|
|
</body>
|
|
</html>
|