index.hbs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <!DOCTYPE HTML>
  2. <html lang="{{ language }}" class="{{ default_theme }} sidebar-visible" dir="{{ text_direction }}">
  3. <head>
  4. <!-- Book generated using mdBook -->
  5. <meta charset="UTF-8">
  6. <title>{{ title }}</title>
  7. {{#if is_print }}
  8. <meta name="robots" content="noindex">
  9. {{/if}}
  10. {{#if base_url}}
  11. <base href="{{ base_url }}">
  12. {{/if}}
  13. <!-- Custom HTML head -->
  14. {{> head}}
  15. <meta name="description" content="{{ description }}">
  16. <meta name="viewport" content="width=device-width, initial-scale=1">
  17. <meta name="theme-color" content="#ffffff">
  18. {{#if favicon_svg}}
  19. <link rel="icon" href="{{ resource "favicon.svg" }}">
  20. {{/if}}
  21. {{#if favicon_png}}
  22. <link rel="shortcut icon" href="{{ resource "favicon.png" }}">
  23. {{/if}}
  24. <link rel="stylesheet" href="{{ resource "css/variables.css" }}">
  25. <link rel="stylesheet" href="{{ resource "fonts/fonts.css" }}">
  26. <link rel="stylesheet" href="{{ resource "css/general.css" }}">
  27. <link rel="stylesheet" href="{{ resource "css/chrome.css" }}">
  28. {{#if print_enable}}
  29. <link rel="stylesheet" href="{{ resource "css/print.css" }}" media="print">
  30. {{/if}}
  31. <!-- Highlight.js Stylesheets -->
  32. <link rel="stylesheet" id="mdbook-highlight-css" href="{{ resource "highlight.css" }}">
  33. <link rel="stylesheet" id="mdbook-tomorrow-night-css" href="{{ resource "tomorrow-night.css" }}">
  34. <link rel="stylesheet" id="mdbook-ayu-highlight-css" href="{{ resource "ayu-highlight.css" }}">
  35. <!-- Custom theme stylesheets -->
  36. {{#each additional_css}}
  37. <link rel="stylesheet" href="{{ resource this }}">
  38. {{/each}}
  39. {{#if mathjax_support}}
  40. <!-- MathJax -->
  41. <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  42. {{/if}}
  43. <!-- Provide site root and default themes to javascript -->
  44. <script>
  45. const path_to_root = "{{ path_to_root }}";
  46. const default_light_theme = "{{ default_theme }}";
  47. const default_dark_theme = "{{ preferred_dark_theme }}";
  48. {{#if search_js}}
  49. window.path_to_searchindex_js = "{{ resource "searchindex.js" }}";
  50. {{/if}}
  51. </script>
  52. <!-- Start loading toc.js asap -->
  53. <script src="{{ resource "toc.js" }}"></script>
  54. </head>
  55. <body>
  56. <div id="mdbook-help-container">
  57. <div id="mdbook-help-popup">
  58. <h2 class="mdbook-help-title">Keyboard shortcuts</h2>
  59. <div>
  60. <p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
  61. {{#if search_enabled}}
  62. <p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
  63. {{/if}}
  64. <p>Press <kbd>?</kbd> to show this help</p>
  65. <p>Press <kbd>Esc</kbd> to hide this help</p>
  66. </div>
  67. </div>
  68. </div>
  69. <div id="mdbook-body-container">
  70. <!-- Work around some values being stored in localStorage wrapped in quotes -->
  71. <script>
  72. try {
  73. let theme = localStorage.getItem('mdbook-theme');
  74. let sidebar = localStorage.getItem('mdbook-sidebar');
  75. if (theme.startsWith('"') && theme.endsWith('"')) {
  76. localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
  77. }
  78. if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
  79. localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
  80. }
  81. } catch (e) { }
  82. </script>
  83. <!-- Set the theme before any content is loaded, prevents flash -->
  84. <script>
  85. const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
  86. let theme;
  87. try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
  88. if (theme === null || theme === undefined) { theme = default_theme; }
  89. const html = document.documentElement;
  90. html.classList.remove('{{ default_theme }}')
  91. html.classList.add(theme);
  92. html.classList.add("js");
  93. </script>
  94. <input type="checkbox" id="mdbook-sidebar-toggle-anchor" class="hidden">
  95. <!-- Hide / unhide sidebar before it is displayed -->
  96. <script>
  97. let sidebar = null;
  98. const sidebar_toggle = document.getElementById("mdbook-sidebar-toggle-anchor");
  99. if (document.body.clientWidth >= 1080) {
  100. try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
  101. sidebar = sidebar || 'visible';
  102. } else {
  103. sidebar = 'hidden';
  104. sidebar_toggle.checked = false;
  105. }
  106. if (sidebar === 'visible') {
  107. sidebar_toggle.checked = true;
  108. } else {
  109. html.classList.remove('sidebar-visible');
  110. }
  111. </script>
  112. <nav id="mdbook-sidebar" class="sidebar" aria-label="Table of contents">
  113. <!-- populated by js -->
  114. <mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
  115. <noscript>
  116. <iframe class="sidebar-iframe-outer" src="{{ path_to_root }}toc.html"></iframe>
  117. </noscript>
  118. <div id="mdbook-sidebar-resize-handle" class="sidebar-resize-handle">
  119. <div class="sidebar-resize-indicator"></div>
  120. </div>
  121. </nav>
  122. <div id="mdbook-page-wrapper" class="page-wrapper">
  123. <div class="page">
  124. {{> header}}
  125. <div id="mdbook-menu-bar-hover-placeholder"></div>
  126. <div id="mdbook-menu-bar" class="menu-bar sticky">
  127. <div class="left-buttons">
  128. <label id="mdbook-sidebar-toggle" class="icon-button" for="mdbook-sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="mdbook-sidebar">
  129. {{fa "solid" "bars"}}
  130. </label>
  131. <button id="mdbook-theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="mdbook-theme-list">
  132. {{fa "solid" "paintbrush"}}
  133. </button>
  134. <ul id="mdbook-theme-list" class="theme-popup" aria-label="Themes" role="menu">
  135. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-default_theme">Auto</button></li>
  136. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-light">Light</button></li>
  137. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-rust">Rust</button></li>
  138. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-coal">Coal</button></li>
  139. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-navy">Navy</button></li>
  140. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-ayu">Ayu</button></li>
  141. <li role="none"><button role="menuitem" class="theme" id="mdbook-theme-darkforest">DarkForest</button></li>
  142. </ul>
  143. {{#if search_enabled}}
  144. <button id="mdbook-search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="mdbook-searchbar">
  145. {{fa "solid" "magnifying-glass"}}
  146. </button>
  147. {{/if}}
  148. </div>
  149. <h1 class="menu-title">{{ book_title }}</h1>
  150. <div class="right-buttons">
  151. {{#if print_enable}}
  152. <a href="{{ path_to_root }}print.html" title="Print this book" aria-label="Print this book">
  153. {{fa "solid" "print" "print-button"}}
  154. </a>
  155. {{/if}}
  156. {{#if git_repository_url}}
  157. <a href="{{git_repository_url}}" title="Git repository" aria-label="Git repository">
  158. {{fa git_repository_icon_class git_repository_icon}}
  159. </a>
  160. {{/if}}
  161. {{#if git_repository_edit_url}}
  162. <a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit" rel="edit">
  163. {{fa "solid" "pencil" "git-edit-button"}}
  164. </a>
  165. {{/if}}
  166. </div>
  167. </div>
  168. {{#if search_enabled}}
  169. <div id="mdbook-search-wrapper" class="hidden">
  170. <form id="mdbook-searchbar-outer" class="searchbar-outer">
  171. <div class="search-wrapper">
  172. <input type="search" id="mdbook-searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="mdbook-searchresults-outer" aria-describedby="searchresults-header">
  173. <div class="spinner-wrapper">
  174. {{fa "solid" "spinner" "fa-spin"}}
  175. </div>
  176. </div>
  177. </form>
  178. <div id="mdbook-searchresults-outer" class="searchresults-outer hidden">
  179. <div id="mdbook-searchresults-header" class="searchresults-header"></div>
  180. <ul id="mdbook-searchresults">
  181. </ul>
  182. </div>
  183. </div>
  184. {{/if}}
  185. <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
  186. <script>
  187. document.getElementById('mdbook-sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
  188. document.getElementById('mdbook-sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
  189. Array.from(document.querySelectorAll('#mdbook-sidebar a')).forEach(function(link) {
  190. link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
  191. });
  192. </script>
  193. <div id="mdbook-content" class="content">
  194. <main>
  195. {{{ content }}}
  196. </main>
  197. <nav class="nav-wrapper" aria-label="Page navigation">
  198. <!-- Mobile navigation buttons -->
  199. {{#if previous}}
  200. <a rel="prev" href="{{ path_to_root }}{{previous.link}}" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  201. {{#if (eq ../text_direction "rtl")}}
  202. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points="19.24 1.18 19.24 .45 18.68 .45 .81 16.15 .81 17.07 18.68 32.77 19.24 32.77 19.24 32.04 1.73 16.61 19.24 1.18"/></svg></span>
  203. {{else}}
  204. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points="19.24 1.18 19.24 .45 18.68 .45 .81 16.15 .81 17.07 18.68 32.77 19.24 32.77 19.24 32.04 1.73 16.61 19.24 1.18"/></svg></span>
  205. {{/if}}
  206. </a>
  207. {{/if}}
  208. {{#if next}}
  209. <a rel="next prefetch" href="{{ path_to_root }}{{next.link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  210. {{#if (eq ../text_direction "rtl")}}
  211. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points=".81 1.18 .81 .45 1.37 .45 19.24 16.15 19.24 17.07 1.37 32.77 .81 32.77 .81 32.04 18.32 16.61 .81 1.18"/></svg></span>
  212. {{else}}
  213. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points=".81 1.18 .81 .45 1.37 .45 19.24 16.15 19.24 17.07 1.37 32.77 .81 32.77 .81 32.04 18.32 16.61 .81 1.18"/></svg></span>
  214. {{/if}}
  215. </a>
  216. {{/if}}
  217. <div style="clear: both"></div>
  218. </nav>
  219. </div>
  220. </div>
  221. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  222. {{#if previous}}
  223. <a rel="prev" href="{{ path_to_root }}{{previous.link}}" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  224. {{#if (eq ../text_direction "rtl")}}
  225. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points="19.24 1.18 19.24 .45 18.68 .45 .81 16.15 .81 17.07 18.68 32.77 19.24 32.77 19.24 32.04 1.73 16.61 19.24 1.18"/></svg></span>
  226. {{else}}
  227. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points="19.24 1.18 19.24 .45 18.68 .45 .81 16.15 .81 17.07 18.68 32.77 19.24 32.77 19.24 32.04 1.73 16.61 19.24 1.18"/></svg></span>
  228. {{/if}}
  229. </a>
  230. {{/if}}
  231. {{#if next}}
  232. <a rel="next prefetch" href="{{ path_to_root }}{{next.link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  233. {{#if (eq text_direction "rtl")}}
  234. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points=".81 1.18 .81 .45 1.37 .45 19.24 16.15 19.24 17.07 1.37 32.77 .81 32.77 .81 32.04 18.32 16.61 .81 1.18"/></svg></span>
  235. {{else}}
  236. <span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 19.85 33.46"><polygon points=".81 1.18 .81 .45 1.37 .45 19.24 16.15 19.24 17.07 1.37 32.77 .81 32.77 .81 32.04 18.32 16.61 .81 1.18"/></svg></span>
  237. {{/if}}
  238. </a>
  239. {{/if}}
  240. </nav>
  241. </div>
  242. <template id=fa-eye>{{fa "solid" "eye"}}</template>
  243. <template id=fa-eye-slash>{{fa "solid" "eye-slash"}}</template>
  244. <template id=fa-copy>{{fa "regular" "copy"}}</template>
  245. <template id=fa-play>{{fa "solid" "play"}}</template>
  246. <template id=fa-clock-rotate-left>{{fa "solid" "clock-rotate-left"}}</template>
  247. {{#if live_reload_endpoint}}
  248. <!-- Livereload script (if served using the cli tool) -->
  249. <script>
  250. const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
  251. const wsAddress = wsProtocol + "//" + location.host + "/" + "{{{live_reload_endpoint}}}";
  252. const socket = new WebSocket(wsAddress);
  253. socket.onmessage = function (event) {
  254. if (event.data === "reload") {
  255. socket.close();
  256. location.reload();
  257. }
  258. };
  259. window.onbeforeunload = function() {
  260. socket.close();
  261. }
  262. </script>
  263. {{/if}}
  264. {{#if playground_line_numbers}}
  265. <script>
  266. window.playground_line_numbers = true;
  267. </script>
  268. {{/if}}
  269. {{#if playground_copyable}}
  270. <script>
  271. window.playground_copyable = true;
  272. </script>
  273. {{/if}}
  274. {{#if playground_js}}
  275. <script src="{{ resource "ace.js" }}"></script>
  276. <script src="{{ resource "mode-rust.js" }}"></script>
  277. <script src="{{ resource "editor.js" }}"></script>
  278. <script src="{{ resource "theme-dawn.js" }}"></script>
  279. <script src="{{ resource "theme-tomorrow_night.js" }}"></script>
  280. {{/if}}
  281. {{#if search_js}}
  282. <script src="{{ resource "elasticlunr.min.js" }}"></script>
  283. <script src="{{ resource "mark.min.js" }}"></script>
  284. <script src="{{ resource "searcher.js" }}"></script>
  285. {{/if}}
  286. <script src="{{ resource "clipboard.min.js" }}"></script>
  287. <script src="{{ resource "highlight.js" }}"></script>
  288. <script src="{{ resource "book.js" }}"></script>
  289. <!-- Custom JS scripts -->
  290. {{#each additional_js}}
  291. <script src="{{ resource this}}"></script>
  292. {{/each}}
  293. {{#if is_print}}
  294. {{#if mathjax_support}}
  295. <script>
  296. window.addEventListener('load', function() {
  297. MathJax.Hub.Register.StartupHook('End', function() {
  298. window.setTimeout(window.print, 100);
  299. });
  300. });
  301. </script>
  302. {{else}}
  303. <script>
  304. window.addEventListener('load', function() {
  305. window.setTimeout(window.print, 100);
  306. });
  307. </script>
  308. {{/if}}
  309. {{/if}}
  310. {{#if fragment_map}}
  311. <script>
  312. document.addEventListener('DOMContentLoaded', function() {
  313. const fragmentMap =
  314. {{{fragment_map}}}
  315. ;
  316. const target = fragmentMap[window.location.hash];
  317. if (target) {
  318. let url = new URL(target, window.location.href);
  319. window.location.replace(url.href);
  320. }
  321. });
  322. </script>
  323. {{/if}}
  324. </div>
  325. </body>
  326. </html>