formatting

This commit is contained in:
Carl Fredrik Samson
2020-04-05 00:07:14 +02:00
parent 0d0c265dc7
commit 971288868b
7 changed files with 35 additions and 30 deletions

View File

@@ -530,9 +530,12 @@ difficult to understand. If I hadn't written it myself I would probably feel
the same. You can always go back and read the book which explains it later.</p>
<h3><a class="header" href="#callback-based-approaches" id="callback-based-approaches">Callback based approaches</a></h3>
<p>You probably already know what we're going to talk about in the next paragraphs
from Javascript which I assume most know. If your exposure to Javascript has
given you any sorts of PTSD earlier in life, close your eyes now and scroll down
for 2-3 seconds. You'll find a link there that takes you to safety.</p>
from Javascript which I assume most know. </p>
<blockquote>
<p>If your exposure to Javascript has given you any sorts of PTSD earlier in life,
close your eyes now and scroll down for 2-3 seconds. You'll find a link there
that takes you to safety.</p>
</blockquote>
<p>The whole idea behind a callback based approach is to save a pointer to a set of
instructions we want to run later. We can save that pointer on the stack before
we yield control to the runtime, or in some sort of collection as we do below.</p>
@@ -689,9 +692,12 @@ promises are <em>eagerly</em> evaluated. That means that once it's created, it s
running a task. Rusts Futures on the other hand is <em>lazily</em> evaluated. They
need to be polled once before they do any work. You'll see in a moment.</p>
</blockquote>
<h1><a class="header" href="#futures-in-rust" id="futures-in-rust">Futures in Rust</a></h1>
<br />
<div style="text-align: center; padding-top: 2em;">
<a href="/1_futures_in_rust.html" style="background: red; color: white; padding:2em 2em 2em 2em; font-size: 1.2em;"><strong>PANIC BUTTON (next chapter)</strong></a>
</div><h1><a class="header" href="#futures-in-rust" id="futures-in-rust">Futures in Rust</a></h1>
<blockquote>
<p><strong>Relevant for:</strong></p>
<p><strong>Overview:</strong></p>
<ul>
<li>High level introduction to concurrency in Rust</li>
<li>Knowing what Rust provides and not when working with async code</li>
@@ -699,10 +705,6 @@ need to be polled once before they do any work. You'll see in a moment.</p>
<li>Getting pointers to further reading on concurrency in general</li>
</ul>
</blockquote>
<p>Before we start implementing our <code>Futures</code> , we'll go through some background
information that will help demystify some of the concepts we encounter.</p>
<p>Actually, after going through these concepts, implementing futures will seem
pretty simple. I promise.</p>
<h2><a class="header" href="#futures" id="futures">Futures</a></h2>
<p>So what is a future?</p>
<p>A future is a representation of some operation which will complete in the