Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 564935689ab5527f955e5449ded02799 > files > 129

rust-doc-1.19.0-1.mga6.armv7hl.rpm

<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Concurrency - The Rust Programming Language</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <base href="">

        <link rel="stylesheet" href="book.css">
        <link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">

        <link rel="shortcut icon" href="favicon.png">

        <!-- Font Awesome -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

        <link rel="stylesheet" href="highlight.css">
        <link rel="stylesheet" href="tomorrow-night.css">

        <!-- MathJax -->
        <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

        <!-- Fetch JQuery from CDN but have a local fallback -->
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <script>
            if (typeof jQuery == 'undefined') {
                document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
            }
        </script>
    </head>
    <body class="light">
        <!-- Set the theme before any content is loaded, prevents flash -->
        <script type="text/javascript">
            var theme = localStorage.getItem('theme');
            if (theme == null) { theme = 'light'; }
            $('body').removeClass().addClass(theme);
        </script>

        <!-- Hide / unhide sidebar before it is displayed -->
        <script type="text/javascript">
            var sidebar = localStorage.getItem('sidebar');
            if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
            else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
        </script>

        <div id="sidebar" class="sidebar">
            <ul class="chapter"><li class="affix"><a href="README.html">Introduction</a></li><li><a href="getting-started.html"><strong>1.</strong> Getting Started</a></li><li><a href="guessing-game.html"><strong>2.</strong> Tutorial: Guessing Game</a></li><li><a href="syntax-and-semantics.html"><strong>3.</strong> Syntax and Semantics</a></li><li><ul class="section"><li><a href="variable-bindings.html"><strong>3.1.</strong> Variable Bindings</a></li><li><a href="functions.html"><strong>3.2.</strong> Functions</a></li><li><a href="primitive-types.html"><strong>3.3.</strong> Primitive Types</a></li><li><a href="comments.html"><strong>3.4.</strong> Comments</a></li><li><a href="if.html"><strong>3.5.</strong> if</a></li><li><a href="loops.html"><strong>3.6.</strong> Loops</a></li><li><a href="vectors.html"><strong>3.7.</strong> Vectors</a></li><li><a href="ownership.html"><strong>3.8.</strong> Ownership</a></li><li><a href="references-and-borrowing.html"><strong>3.9.</strong> References and Borrowing</a></li><li><a href="lifetimes.html"><strong>3.10.</strong> Lifetimes</a></li><li><a href="mutability.html"><strong>3.11.</strong> Mutability</a></li><li><a href="structs.html"><strong>3.12.</strong> Structs</a></li><li><a href="enums.html"><strong>3.13.</strong> Enums</a></li><li><a href="match.html"><strong>3.14.</strong> Match</a></li><li><a href="patterns.html"><strong>3.15.</strong> Patterns</a></li><li><a href="method-syntax.html"><strong>3.16.</strong> Method Syntax</a></li><li><a href="strings.html"><strong>3.17.</strong> Strings</a></li><li><a href="generics.html"><strong>3.18.</strong> Generics</a></li><li><a href="traits.html"><strong>3.19.</strong> Traits</a></li><li><a href="drop.html"><strong>3.20.</strong> Drop</a></li><li><a href="if-let.html"><strong>3.21.</strong> if let</a></li><li><a href="trait-objects.html"><strong>3.22.</strong> Trait Objects</a></li><li><a href="closures.html"><strong>3.23.</strong> Closures</a></li><li><a href="ufcs.html"><strong>3.24.</strong> Universal Function Call Syntax</a></li><li><a href="crates-and-modules.html"><strong>3.25.</strong> Crates and Modules</a></li><li><a href="const-and-static.html"><strong>3.26.</strong> <code>const</code> and <code>static</code></a></li><li><a href="attributes.html"><strong>3.27.</strong> Attributes</a></li><li><a href="type-aliases.html"><strong>3.28.</strong> <code>type</code> aliases</a></li><li><a href="casting-between-types.html"><strong>3.29.</strong> Casting between types</a></li><li><a href="associated-types.html"><strong>3.30.</strong> Associated Types</a></li><li><a href="unsized-types.html"><strong>3.31.</strong> Unsized Types</a></li><li><a href="operators-and-overloading.html"><strong>3.32.</strong> Operators and Overloading</a></li><li><a href="deref-coercions.html"><strong>3.33.</strong> Deref coercions</a></li><li><a href="macros.html"><strong>3.34.</strong> Macros</a></li><li><a href="raw-pointers.html"><strong>3.35.</strong> Raw Pointers</a></li><li><a href="unsafe.html"><strong>3.36.</strong> <code>unsafe</code></a></li></ul></li><li><a href="effective-rust.html"><strong>4.</strong> Effective Rust</a></li><li><ul class="section"><li><a href="the-stack-and-the-heap.html"><strong>4.1.</strong> The Stack and the Heap</a></li><li><a href="testing.html"><strong>4.2.</strong> Testing</a></li><li><a href="conditional-compilation.html"><strong>4.3.</strong> Conditional Compilation</a></li><li><a href="documentation.html"><strong>4.4.</strong> Documentation</a></li><li><a href="iterators.html"><strong>4.5.</strong> Iterators</a></li><li><a href="concurrency.html" class="active"><strong>4.6.</strong> Concurrency</a></li><li><a href="error-handling.html"><strong>4.7.</strong> Error Handling</a></li><li><a href="choosing-your-guarantees.html"><strong>4.8.</strong> Choosing your Guarantees</a></li><li><a href="ffi.html"><strong>4.9.</strong> FFI</a></li><li><a href="borrow-and-asref.html"><strong>4.10.</strong> Borrow and AsRef</a></li><li><a href="release-channels.html"><strong>4.11.</strong> Release Channels</a></li><li><a href="using-rust-without-the-standard-library.html"><strong>4.12.</strong> Using Rust without the standard library</a></li><li><a href="procedural-macros.html"><strong>4.13.</strong> Procedural Macros (and custom derive)</a></li></ul></li><li><a href="glossary.html"><strong>5.</strong> Glossary</a></li><li><a href="syntax-index.html"><strong>6.</strong> Syntax Index</a></li><li><a href="bibliography.html"><strong>7.</strong> Bibliography</a></li></ul>
        </div>

        <div id="page-wrapper" class="page-wrapper">

            <div class="page">
                <div id="menu-bar" class="menu-bar">
                    <div class="left-buttons">
                        <i id="sidebar-toggle" class="fa fa-bars"></i>
                        <i id="theme-toggle" class="fa fa-paint-brush"></i>
                    </div>

                    <h1 class="menu-title">The Rust Programming Language</h1>

                    <div class="right-buttons">
                        <i id="print-button" class="fa fa-print" title="Print this book"></i>
                    </div>
                </div>

                <div id="content" class="content">
                    <a class="header" href="concurrency.html#concurrency" id="concurrency"><h1>Concurrency</h1></a>
<p>Concurrency and parallelism are incredibly important topics in computer
science, and are also a hot topic in industry today. Computers are gaining more
and more cores, yet many programmers aren't prepared to fully utilize them.</p>
<p>Rust's memory safety features also apply to its concurrency story. Even
concurrent Rust programs must be memory safe, having no data races. Rust's type
system is up to the task, and gives you powerful ways to reason about
concurrent code at compile time.</p>
<p>Before we talk about the concurrency features that come with Rust, it's important
to understand something: Rust is low-level enough that the vast majority of
this is provided by the standard library, not by the language. This means that
if you don't like some aspect of the way Rust handles concurrency, you can
implement an alternative way of doing things.
<a href="https://github.com/carllerche/mio">mio</a> is a real-world example of this
principle in action.</p>
<a class="header" href="concurrency.html#background-send-and-sync" id="background-send-and-sync"><h2>Background: <code>Send</code> and <code>Sync</code></h2></a>
<p>Concurrency is difficult to reason about. In Rust, we have a strong, static
type system to help us reason about our code. As such, Rust gives us two traits
to help us make sense of code that can possibly be concurrent.</p>
<a class="header" href="concurrency.html#send" id="send"><h3><code>Send</code></h3></a>
<p>The first trait we're going to talk about is
<a href="../../std/marker/trait.Send.html"><code>Send</code></a>. When a type <code>T</code> implements <code>Send</code>, it
indicates that something of this type is able to have ownership transferred
safely between threads.</p>
<p>This is important to enforce certain restrictions. For example, if we have a
channel connecting two threads, we would want to be able to send some data
down the channel and to the other thread. Therefore, we'd ensure that <code>Send</code> was
implemented for that type.</p>
<p>In the opposite way, if we were wrapping a library with <a href="ffi.html">FFI</a> that isn't
thread-safe, we wouldn't want to implement <code>Send</code>, and so the compiler will help
us enforce that it can't leave the current thread.</p>
<a class="header" href="concurrency.html#sync" id="sync"><h3><code>Sync</code></h3></a>
<p>The second of these traits is called <a href="../../std/marker/trait.Sync.html"><code>Sync</code></a>.
When a type <code>T</code> implements <code>Sync</code>, it indicates that something
of this type has no possibility of introducing memory unsafety when used from
multiple threads concurrently through shared references. This implies that
types which don't have <a href="mutability.html">interior mutability</a> are inherently
<code>Sync</code>, which includes simple primitive types (like <code>u8</code>) and aggregate types
containing them.</p>
<p>For sharing references across threads, Rust provides a wrapper type called
<code>Arc&lt;T&gt;</code>. <code>Arc&lt;T&gt;</code> implements <code>Send</code> and <code>Sync</code> if and only if <code>T</code> implements
both <code>Send</code> and <code>Sync</code>. For example, an object of type <code>Arc&lt;RefCell&lt;U&gt;&gt;</code> cannot
be transferred across threads because
<a href="choosing-your-guarantees.html#refcellt"><code>RefCell</code></a> does not implement
<code>Sync</code>, consequently <code>Arc&lt;RefCell&lt;U&gt;&gt;</code> would not implement <code>Send</code>.</p>
<p>These two traits allow you to use the type system to make strong guarantees
about the properties of your code under concurrency. Before we demonstrate
why, we need to learn how to create a concurrent Rust program in the first
place!</p>
<a class="header" href="concurrency.html#threads" id="threads"><h2>Threads</h2></a>
<p>Rust's standard library provides a library for threads, which allow you to
run Rust code in parallel. Here's a basic example of using <code>std::thread</code>:</p>
<pre><pre class="playpen"><code class="language-rust">use std::thread;

fn main() {
    thread::spawn(|| {
        println!(&quot;Hello from a thread!&quot;);
    });
}
</code></pre></pre>
<p>The <code>thread::spawn()</code> method accepts a <a href="closures.html">closure</a>, which is executed in a
new thread. It returns a handle to the thread, that can be used to
wait for the child thread to finish and extract its result:</p>
<pre><pre class="playpen"><code class="language-rust">use std::thread;

fn main() {
    let handle = thread::spawn(|| {
        &quot;Hello from a thread!&quot;
    });

    println!(&quot;{}&quot;, handle.join().unwrap());
}
</code></pre></pre>
<p>As closures can capture variables from their environment, we can also try to
bring some data into the other thread:</p>
<pre><code class="language-rust ignore">use std::thread;

fn main() {
    let x = 1;
    thread::spawn(|| {
        println!(&quot;x is {}&quot;, x);
    });
}
</code></pre>
<p>However, this gives us an error:</p>
<pre><code class="language-text">5:19: 7:6 error: closure may outlive the current function, but it
                 borrows `x`, which is owned by the current function
...
5:19: 7:6 help: to force the closure to take ownership of `x` (and any other referenced variables),
          use the `move` keyword, as shown:
      thread::spawn(move || {
          println!(&quot;x is {}&quot;, x);
      });
</code></pre>
<p>This is because by default closures capture variables by reference, and thus the
closure only captures a <em>reference to <code>x</code></em>. This is a problem, because the
thread may outlive the scope of <code>x</code>, leading to a dangling pointer.</p>
<p>To fix this, we use a <code>move</code> closure as mentioned in the error message. <code>move</code>
closures are explained in depth <a href="closures.html#move-closures">here</a>; basically
they move variables from their environment into themselves.</p>
<pre><pre class="playpen"><code class="language-rust">use std::thread;

fn main() {
    let x = 1;
    thread::spawn(move || {
        println!(&quot;x is {}&quot;, x);
    });
}
</code></pre></pre>
<p>Many languages have the ability to execute threads, but it's wildly unsafe.
There are entire books about how to prevent errors that occur from shared
mutable state. Rust helps out with its type system here as well, by preventing
data races at compile time. Let's talk about how you actually share things
between threads.</p>
<a class="header" href="concurrency.html#safe-shared-mutable-state" id="safe-shared-mutable-state"><h2>Safe Shared Mutable State</h2></a>
<p>Due to Rust's type system, we have a concept that sounds like a lie: &quot;safe
shared mutable state.&quot; Many programmers agree that shared mutable state is
very, very bad.</p>
<p>Someone once said this:</p>
<blockquote>
<p>Shared mutable state is the root of all evil. Most languages attempt to deal
with this problem through the 'mutable' part, but Rust deals with it by
solving the 'shared' part.</p>
</blockquote>
<p>The same <a href="ownership.html">ownership system</a> that helps prevent using pointers
incorrectly also helps rule out data races, one of the worst kinds of
concurrency bugs.</p>
<p>As an example, here is a Rust program that would have a data race in many
languages. It will not compile:</p>
<pre><code class="language-rust ignore">use std::thread;
use std::time::Duration;

fn main() {
    let mut data = vec![1, 2, 3];

    for i in 0..3 {
        thread::spawn(move || {
            data[0] += i;
        });
    }

    thread::sleep(Duration::from_millis(50));
}
</code></pre>
<p>This gives us an error:</p>
<pre><code class="language-text">8:17 error: capture of moved value: `data`
        data[0] += i;
        ^~~~
</code></pre>
<p>Rust knows this wouldn't be safe! If we had a reference to <code>data</code> in each
thread, and the thread takes ownership of the reference, we'd have three owners!
<code>data</code> gets moved out of <code>main</code> in the first call to <code>spawn()</code>, so subsequent
calls in the loop cannot use this variable.</p>
<p>So, we need some type that lets us have more than one owning reference to a
value. Usually, we'd use <code>Rc&lt;T&gt;</code> for this, which is a reference counted type
that provides shared ownership. It has some runtime bookkeeping that keeps track
of the number of references to it, hence the &quot;reference count&quot; part of its name.</p>
<p>Calling <code>clone()</code> on an <code>Rc&lt;T&gt;</code> will return a new owned reference and bump the
internal reference count. We create one of these for each thread:</p>
<pre><code class="language-rust ignore">use std::thread;
use std::time::Duration;
use std::rc::Rc;

fn main() {
    let mut data = Rc::new(vec![1, 2, 3]);

    for i in 0..3 {
        // Create a new owned reference:
        let data_ref = data.clone();

        // Use it in a thread:
        thread::spawn(move || {
            data_ref[0] += i;
        });
    }

    thread::sleep(Duration::from_millis(50));
}
</code></pre>
<p>This won't work, however, and will give us the error:</p>
<pre><code class="language-text">13:9: 13:22 error: the trait bound `alloc::rc::Rc&lt;collections::vec::Vec&lt;i32&gt;&gt; : core::marker::Send`
            is not satisfied
...
13:9: 13:22 note: `alloc::rc::Rc&lt;collections::vec::Vec&lt;i32&gt;&gt;`
            cannot be sent between threads safely
</code></pre>
<p>As the error message mentions, <code>Rc</code> cannot be sent between threads safely. This
is because the internal reference count is not maintained in a thread safe
manner and can have a data race.</p>
<p>To solve this, we'll use <code>Arc&lt;T&gt;</code>, Rust's standard atomic reference count type.</p>
<p>The Atomic part means <code>Arc&lt;T&gt;</code> can safely be accessed from multiple threads.
To do this the compiler guarantees that mutations of the internal count use
indivisible operations which can't have data races.</p>
<p>In essence, <code>Arc&lt;T&gt;</code> is a type that lets us share ownership of data <em>across
threads</em>.</p>
<pre><code class="language-rust ignore">use std::thread;
use std::sync::Arc;
use std::time::Duration;

fn main() {
    let mut data = Arc::new(vec![1, 2, 3]);

    for i in 0..3 {
        let data = data.clone();
        thread::spawn(move || {
            data[0] += i;
        });
    }

    thread::sleep(Duration::from_millis(50));
}
</code></pre>
<p>Similarly to last time, we use <code>clone()</code> to create a new owned handle.
This handle is then moved into the new thread.</p>
<p>And... still gives us an error.</p>
<pre><code class="language-text">&lt;anon&gt;:11:24 error: cannot borrow immutable borrowed content as mutable
&lt;anon&gt;:11                    data[0] += i;
                             ^~~~
</code></pre>
<p><code>Arc&lt;T&gt;</code> by default has immutable contents. It allows the <em>sharing</em> of data
between threads, but shared mutable data is unsafe—and when threads are
involved—can cause data races!</p>
<p>Usually when we wish to make something in an immutable position mutable, we use
<code>Cell&lt;T&gt;</code> or <code>RefCell&lt;T&gt;</code> which allow safe mutation via runtime checks or
otherwise (see also: <a href="choosing-your-guarantees.html">Choosing Your Guarantees</a>).
However, similar to <code>Rc</code>, these are not thread safe. If we try using these, we
will get an error about these types not being <code>Sync</code>, and the code will fail to
compile.</p>
<p>It looks like we need some type that allows us to safely mutate a shared value
across threads, for example a type that can ensure only one thread at a time is
able to mutate the value inside it at any one time.</p>
<p>For that, we can use the <code>Mutex&lt;T&gt;</code> type!</p>
<p>Here's the working version:</p>
<pre><pre class="playpen"><code class="language-rust">use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;

fn main() {
    let data = Arc::new(Mutex::new(vec![1, 2, 3]));

    for i in 0..3 {
        let data = data.clone();
        thread::spawn(move || {
            let mut data = data.lock().unwrap();
            data[0] += i;
        });
    }

    thread::sleep(Duration::from_millis(50));
}
</code></pre></pre>
<p>Note that the value of <code>i</code> is bound (copied) to the closure and not shared
among the threads.</p>
<p>We're &quot;locking&quot; the mutex here. A mutex (short for &quot;mutual exclusion&quot;), as
mentioned, only allows one thread at a time to access a value. When we wish to
access the value, we use <code>lock()</code> on it. This will &quot;lock&quot; the mutex, and no
other thread will be able to lock it (and hence, do anything with the value)
until we're done with it. If a thread attempts to lock a mutex which is already
locked, it will wait until the other thread releases the lock.</p>
<p>The lock &quot;release&quot; here is implicit; when the result of the lock (in this case,
<code>data</code>) goes out of scope, the lock is automatically released.</p>
<p>Note that <a href="../../std/sync/struct.Mutex.html#method.lock"><code>lock</code></a> method of
<a href="../../std/sync/struct.Mutex.html"><code>Mutex</code></a> has this signature:</p>
<pre><code class="language-rust ignore">fn lock(&amp;self) -&gt; LockResult&lt;MutexGuard&lt;T&gt;&gt;
</code></pre>
<p>and because <code>Send</code> is not implemented for <code>MutexGuard&lt;T&gt;</code>, the guard cannot
cross thread boundaries, ensuring thread-locality of lock acquire and release.</p>
<p>Let's examine the body of the thread more closely:</p>
<pre><pre class="playpen"><code class="language-rust"># use std::sync::{Arc, Mutex};
# use std::thread;
# use std::time::Duration;
# fn main() {
#     let data = Arc::new(Mutex::new(vec![1, 2, 3]));
#     for i in 0..3 {
#         let data = data.clone();
thread::spawn(move || {
    let mut data = data.lock().unwrap();
    data[0] += i;
});
#     }
#     thread::sleep(Duration::from_millis(50));
# }
</code></pre></pre>
<p>First, we call <code>lock()</code>, which acquires the mutex's lock. Because this may fail,
it returns a <code>Result&lt;T, E&gt;</code>, and because this is just an example, we <code>unwrap()</code>
it to get a reference to the data. Real code would have more robust error handling
here. We're then free to mutate it, since we have the lock.</p>
<p>Lastly, while the threads are running, we wait on a short timer. But
this is not ideal: we may have picked a reasonable amount of time to
wait but it's more likely we'll either be waiting longer than
necessary or not long enough, depending on just how much time the
threads actually take to finish computing when the program runs.</p>
<p>A more precise alternative to the timer would be to use one of the
mechanisms provided by the Rust standard library for synchronizing
threads with each other. Let's talk about one of them: channels.</p>
<a class="header" href="concurrency.html#channels" id="channels"><h2>Channels</h2></a>
<p>Here's a version of our code that uses channels for synchronization, rather
than waiting for a specific time:</p>
<pre><pre class="playpen"><code class="language-rust">use std::sync::{Arc, Mutex};
use std::thread;
use std::sync::mpsc;

fn main() {
    let data = Arc::new(Mutex::new(0));

    // `tx` is the &quot;transmitter&quot; or &quot;sender&quot;.
    // `rx` is the &quot;receiver&quot;.
    let (tx, rx) = mpsc::channel();

    for _ in 0..10 {
        let (data, tx) = (data.clone(), tx.clone());

        thread::spawn(move || {
            let mut data = data.lock().unwrap();
            *data += 1;

            tx.send(()).unwrap();
        });
    }

    for _ in 0..10 {
        rx.recv().unwrap();
    }
}
</code></pre></pre>
<p>We use the <code>mpsc::channel()</code> method to construct a new channel. We <code>send</code>
a simple <code>()</code> down the channel, and then wait for ten of them to come back.</p>
<p>While this channel is sending a generic signal, we can send any data that
is <code>Send</code> over the channel!</p>
<pre><pre class="playpen"><code class="language-rust">use std::thread;
use std::sync::mpsc;

fn main() {
    let (tx, rx) = mpsc::channel();

    for i in 0..10 {
        let tx = tx.clone();

        thread::spawn(move || {
            let answer = i * i;

            tx.send(answer).unwrap();
        });
    }

    for _ in 0..10 {
        println!(&quot;{}&quot;, rx.recv().unwrap());
    }
}
</code></pre></pre>
<p>Here we create 10 threads, asking each to calculate the square of a number (<code>i</code>
at the time of <code>spawn()</code>), and then <code>send()</code> back the answer over the channel.</p>
<a class="header" href="concurrency.html#panics" id="panics"><h2>Panics</h2></a>
<p>A <code>panic!</code> will crash the currently executing thread. You can use Rust's
threads as a simple isolation mechanism:</p>
<pre><pre class="playpen"><code class="language-rust"># #![allow(unused_variables)]
#fn main() {
use std::thread;

let handle = thread::spawn(move || {
    panic!(&quot;oops!&quot;);
});

let result = handle.join();

assert!(result.is_err());

#}</code></pre></pre>
<p><code>Thread.join()</code> gives us a <code>Result</code> back, which allows us to check if the thread
has panicked or not.</p>

                </div>

                <!-- Mobile navigation buttons -->
                
                    <a href="iterators.html" class="mobile-nav-chapters previous">
                        <i class="fa fa-angle-left"></i>
                    </a>
                

                
                    <a href="error-handling.html" class="mobile-nav-chapters next">
                        <i class="fa fa-angle-right"></i>
                    </a>
                

            </div>

            
                <a href="iterators.html" class="nav-chapters previous" title="You can navigate through the chapters using the arrow keys">
                    <i class="fa fa-angle-left"></i>
                </a>
            

            
                <a href="error-handling.html" class="nav-chapters next" title="You can navigate through the chapters using the arrow keys">
                    <i class="fa fa-angle-right"></i>
                </a>
            

        </div>


        <!-- Local fallback for Font Awesome -->
        <script>
            if ($(".fa").css("font-family") !== "FontAwesome") {
                $('<link rel="stylesheet" type="text/css" href="_FontAwesome/css/font-awesome.css">').prependTo('head');
            }
        </script>

        <!-- Livereload script (if served using the cli tool) -->
        

        <script src="highlight.js"></script>
        <script src="book.js"></script>
    </body>
</html>