|  | 
|  | 1 | +<!DOCTYPE HTML> | 
|  | 2 | +<html lang="en" class="light sidebar-visible" dir="ltr"> | 
|  | 3 | +    <head> | 
|  | 4 | +        <!-- Book generated using mdBook --> | 
|  | 5 | +        <meta charset="UTF-8"> | 
|  | 6 | +        <title>Getting Started - Asynchronous Programming in Rust</title> | 
|  | 7 | + | 
|  | 8 | + | 
|  | 9 | +        <!-- Custom HTML head --> | 
|  | 10 | + | 
|  | 11 | +        <meta name="description" content=""> | 
|  | 12 | +        <meta name="viewport" content="width=device-width, initial-scale=1"> | 
|  | 13 | +        <meta name="theme-color" content="#ffffff"> | 
|  | 14 | + | 
|  | 15 | +        <link rel="icon" href="../favicon.svg"> | 
|  | 16 | +        <link rel="shortcut icon" href="../favicon.png"> | 
|  | 17 | +        <link rel="stylesheet" href="../css/variables.css"> | 
|  | 18 | +        <link rel="stylesheet" href="../css/general.css"> | 
|  | 19 | +        <link rel="stylesheet" href="../css/chrome.css"> | 
|  | 20 | +        <link rel="stylesheet" href="../css/print.css" media="print"> | 
|  | 21 | + | 
|  | 22 | +        <!-- Fonts --> | 
|  | 23 | +        <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> | 
|  | 24 | +        <link rel="stylesheet" href="../fonts/fonts.css"> | 
|  | 25 | + | 
|  | 26 | +        <!-- Highlight.js Stylesheets --> | 
|  | 27 | +        <link rel="stylesheet" href="../highlight.css"> | 
|  | 28 | +        <link rel="stylesheet" href="../tomorrow-night.css"> | 
|  | 29 | +        <link rel="stylesheet" href="../ayu-highlight.css"> | 
|  | 30 | + | 
|  | 31 | +        <!-- Custom theme stylesheets --> | 
|  | 32 | + | 
|  | 33 | + | 
|  | 34 | +        <!-- Provide site root to javascript --> | 
|  | 35 | +        <script> | 
|  | 36 | +            var path_to_root = "../"; | 
|  | 37 | +            var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; | 
|  | 38 | +        </script> | 
|  | 39 | +        <!-- Start loading toc.js asap --> | 
|  | 40 | +        <script src="../toc.js"></script> | 
|  | 41 | +    </head> | 
|  | 42 | +    <body> | 
|  | 43 | +    <div id="body-container"> | 
|  | 44 | +        <!-- Work around some values being stored in localStorage wrapped in quotes --> | 
|  | 45 | +        <script> | 
|  | 46 | +            try { | 
|  | 47 | +                var theme = localStorage.getItem('mdbook-theme'); | 
|  | 48 | +                var sidebar = localStorage.getItem('mdbook-sidebar'); | 
|  | 49 | + | 
|  | 50 | +                if (theme.startsWith('"') && theme.endsWith('"')) { | 
|  | 51 | +                    localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); | 
|  | 52 | +                } | 
|  | 53 | + | 
|  | 54 | +                if (sidebar.startsWith('"') && sidebar.endsWith('"')) { | 
|  | 55 | +                    localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); | 
|  | 56 | +                } | 
|  | 57 | +            } catch (e) { } | 
|  | 58 | +        </script> | 
|  | 59 | + | 
|  | 60 | +        <!-- Set the theme before any content is loaded, prevents flash --> | 
|  | 61 | +        <script> | 
|  | 62 | +            var theme; | 
|  | 63 | +            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } | 
|  | 64 | +            if (theme === null || theme === undefined) { theme = default_theme; } | 
|  | 65 | +            const html = document.documentElement; | 
|  | 66 | +            html.classList.remove('light') | 
|  | 67 | +            html.classList.add(theme); | 
|  | 68 | +            html.classList.add("js"); | 
|  | 69 | +        </script> | 
|  | 70 | + | 
|  | 71 | +        <input type="checkbox" id="sidebar-toggle-anchor" class="hidden"> | 
|  | 72 | + | 
|  | 73 | +        <!-- Hide / unhide sidebar before it is displayed --> | 
|  | 74 | +        <script> | 
|  | 75 | +            var sidebar = null; | 
|  | 76 | +            var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); | 
|  | 77 | +            if (document.body.clientWidth >= 1080) { | 
|  | 78 | +                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } | 
|  | 79 | +                sidebar = sidebar || 'visible'; | 
|  | 80 | +            } else { | 
|  | 81 | +                sidebar = 'hidden'; | 
|  | 82 | +            } | 
|  | 83 | +            sidebar_toggle.checked = sidebar === 'visible'; | 
|  | 84 | +            html.classList.remove('sidebar-visible'); | 
|  | 85 | +            html.classList.add("sidebar-" + sidebar); | 
|  | 86 | +        </script> | 
|  | 87 | + | 
|  | 88 | +        <nav id="sidebar" class="sidebar" aria-label="Table of contents"> | 
|  | 89 | +            <!-- populated by js --> | 
|  | 90 | +            <mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox> | 
|  | 91 | +            <noscript> | 
|  | 92 | +                <iframe class="sidebar-iframe-outer" src="../toc.html"></iframe> | 
|  | 93 | +            </noscript> | 
|  | 94 | +            <div id="sidebar-resize-handle" class="sidebar-resize-handle"> | 
|  | 95 | +                <div class="sidebar-resize-indicator"></div> | 
|  | 96 | +            </div> | 
|  | 97 | +        </nav> | 
|  | 98 | + | 
|  | 99 | +        <div id="page-wrapper" class="page-wrapper"> | 
|  | 100 | + | 
|  | 101 | +            <div class="page"> | 
|  | 102 | +                <div id="menu-bar-hover-placeholder"></div> | 
|  | 103 | +                <div id="menu-bar" class="menu-bar sticky"> | 
|  | 104 | +                    <div class="left-buttons"> | 
|  | 105 | +                        <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> | 
|  | 106 | +                            <i class="fa fa-bars"></i> | 
|  | 107 | +                        </label> | 
|  | 108 | +                        <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> | 
|  | 109 | +                            <i class="fa fa-paint-brush"></i> | 
|  | 110 | +                        </button> | 
|  | 111 | +                        <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> | 
|  | 112 | +                            <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li> | 
|  | 113 | +                            <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> | 
|  | 114 | +                            <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> | 
|  | 115 | +                            <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> | 
|  | 116 | +                            <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> | 
|  | 117 | +                        </ul> | 
|  | 118 | +                        <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> | 
|  | 119 | +                            <i class="fa fa-search"></i> | 
|  | 120 | +                        </button> | 
|  | 121 | +                    </div> | 
|  | 122 | + | 
|  | 123 | +                    <h1 class="menu-title">Asynchronous Programming in Rust</h1> | 
|  | 124 | + | 
|  | 125 | +                    <div class="right-buttons"> | 
|  | 126 | +                        <a href="../print.html" title="Print this book" aria-label="Print this book"> | 
|  | 127 | +                            <i id="print-button" class="fa fa-print"></i> | 
|  | 128 | +                        </a> | 
|  | 129 | +                        <a href="https://github.com/rust-lang/async-book" title="Git repository" aria-label="Git repository"> | 
|  | 130 | +                            <i id="git-repository-button" class="fa fa-github"></i> | 
|  | 131 | +                        </a> | 
|  | 132 | + | 
|  | 133 | +                    </div> | 
|  | 134 | +                </div> | 
|  | 135 | + | 
|  | 136 | +                <div id="search-wrapper" class="hidden"> | 
|  | 137 | +                    <form id="searchbar-outer" class="searchbar-outer"> | 
|  | 138 | +                        <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> | 
|  | 139 | +                    </form> | 
|  | 140 | +                    <div id="searchresults-outer" class="searchresults-outer hidden"> | 
|  | 141 | +                        <div id="searchresults-header" class="searchresults-header"></div> | 
|  | 142 | +                        <ul id="searchresults"> | 
|  | 143 | +                        </ul> | 
|  | 144 | +                    </div> | 
|  | 145 | +                </div> | 
|  | 146 | + | 
|  | 147 | +                <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> | 
|  | 148 | +                <script> | 
|  | 149 | +                    document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); | 
|  | 150 | +                    document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); | 
|  | 151 | +                    Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { | 
|  | 152 | +                        link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); | 
|  | 153 | +                    }); | 
|  | 154 | +                </script> | 
|  | 155 | + | 
|  | 156 | +                <div id="content" class="content"> | 
|  | 157 | +                    <main> | 
|  | 158 | +                        <h1 id="getting-started"><a class="header" href="#getting-started">Getting Started</a></h1> | 
|  | 159 | +<p>Welcome to Asynchronous Programming in Rust! If you're looking to start writing | 
|  | 160 | +asynchronous Rust code, you've come to the right place. Whether you're building | 
|  | 161 | +a web server, a database, or an operating system, this book will show you | 
|  | 162 | +how to use Rust's asynchronous programming tools to get the most out of your | 
|  | 163 | +hardware.</p> | 
|  | 164 | +<h2 id="what-this-book-covers"><a class="header" href="#what-this-book-covers">What This Book Covers</a></h2> | 
|  | 165 | +<p>This book aims to be a comprehensive, up-to-date guide to using Rust's async | 
|  | 166 | +language features and libraries, appropriate for beginners and old hands alike.</p> | 
|  | 167 | +<ul> | 
|  | 168 | +<li> | 
|  | 169 | +<p>The early chapters provide an introduction to async programming in general, | 
|  | 170 | +and to Rust's particular take on it.</p> | 
|  | 171 | +</li> | 
|  | 172 | +<li> | 
|  | 173 | +<p>The middle chapters discuss key utilities and control-flow tools you can use | 
|  | 174 | +when writing async code, and describe best-practices for structuring libraries | 
|  | 175 | +and applications to maximize performance and reusability.</p> | 
|  | 176 | +</li> | 
|  | 177 | +<li> | 
|  | 178 | +<p>The last section of the book covers the broader async ecosystem, and provides | 
|  | 179 | +a number of examples of how to accomplish common tasks.</p> | 
|  | 180 | +</li> | 
|  | 181 | +</ul> | 
|  | 182 | +<p>With that out of the way, let's explore the exciting world of Asynchronous | 
|  | 183 | +Programming in Rust!</p> | 
|  | 184 | + | 
|  | 185 | +                    </main> | 
|  | 186 | + | 
|  | 187 | +                    <nav class="nav-wrapper" aria-label="Page navigation"> | 
|  | 188 | +                        <!-- Mobile navigation buttons --> | 
|  | 189 | +                            <a rel="prev" href="../part-guide/streams.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> | 
|  | 190 | +                                <i class="fa fa-angle-left"></i> | 
|  | 191 | +                            </a> | 
|  | 192 | + | 
|  | 193 | +                            <a rel="next prefetch" href="../01_getting_started/02_why_async.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> | 
|  | 194 | +                                <i class="fa fa-angle-right"></i> | 
|  | 195 | +                            </a> | 
|  | 196 | + | 
|  | 197 | +                        <div style="clear: both"></div> | 
|  | 198 | +                    </nav> | 
|  | 199 | +                </div> | 
|  | 200 | +            </div> | 
|  | 201 | + | 
|  | 202 | +            <nav class="nav-wide-wrapper" aria-label="Page navigation"> | 
|  | 203 | +                    <a rel="prev" href="../part-guide/streams.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> | 
|  | 204 | +                        <i class="fa fa-angle-left"></i> | 
|  | 205 | +                    </a> | 
|  | 206 | + | 
|  | 207 | +                    <a rel="next prefetch" href="../01_getting_started/02_why_async.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> | 
|  | 208 | +                        <i class="fa fa-angle-right"></i> | 
|  | 209 | +                    </a> | 
|  | 210 | +            </nav> | 
|  | 211 | + | 
|  | 212 | +        </div> | 
|  | 213 | + | 
|  | 214 | + | 
|  | 215 | + | 
|  | 216 | + | 
|  | 217 | +        <script> | 
|  | 218 | +            window.playground_copyable = true; | 
|  | 219 | +        </script> | 
|  | 220 | + | 
|  | 221 | + | 
|  | 222 | +        <script src="../elasticlunr.min.js"></script> | 
|  | 223 | +        <script src="../mark.min.js"></script> | 
|  | 224 | +        <script src="../searcher.js"></script> | 
|  | 225 | + | 
|  | 226 | +        <script src="../clipboard.min.js"></script> | 
|  | 227 | +        <script src="../highlight.js"></script> | 
|  | 228 | +        <script src="../book.js"></script> | 
|  | 229 | + | 
|  | 230 | +        <!-- Custom JS scripts --> | 
|  | 231 | + | 
|  | 232 | + | 
|  | 233 | +    </div> | 
|  | 234 | +    </body> | 
|  | 235 | +</html> | 
0 commit comments