1<!DOCTYPE HTML> 2<html lang="en" class="sidebar-visible no-js light"> 3 <head> 4 <!-- Book generated using mdBook --> 5 <meta charset="UTF-8"> 6 <title>FAQ - Dyner - More dyn than ever</title> 7 8 9 10 11 <!-- Custom HTML head --> 12 13 14 15 <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> 16 <meta name="description" content=""> 17 <meta name="viewport" content="width=device-width, initial-scale=1"> 18 <meta name="theme-color" content="#ffffff" /> 19 20 21 <link rel="icon" href="favicon.svg"> 22 23 24 <link rel="shortcut icon" href="favicon.png"> 25 26 <link rel="stylesheet" href="css/variables.css"> 27 <link rel="stylesheet" href="css/general.css"> 28 <link rel="stylesheet" href="css/chrome.css"> 29 30 <link rel="stylesheet" href="css/print.css" media="print"> 31 32 33 <!-- Fonts --> 34 <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> 35 36 <link rel="stylesheet" href="fonts/fonts.css"> 37 38 39 <!-- Highlight.js Stylesheets --> 40 <link rel="stylesheet" href="highlight.css"> 41 <link rel="stylesheet" href="tomorrow-night.css"> 42 <link rel="stylesheet" href="ayu-highlight.css"> 43 44 <!-- Custom theme stylesheets --> 45 46 47 48 </head> 49 <body> 50 <!-- Provide site root to javascript --> 51
51<script type="text/javascript"> 52 var path_to_root = ""; 53 var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; 54 </script>
54 55 56 <!-- Work around some values being stored in localStorage wrapped in quotes --> 57
57<script type="text/javascript"> 58 try { 59 var theme = localStorage.getItem('mdbook-theme'); 60 var sidebar = localStorage.getItem('mdbook-sidebar'); 61 62 if (theme.startsWith('"') && theme.endsWith('"')) { 63 localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); 64 } 65 66 if (sidebar.startsWith('"') && sidebar.endsWith('"')) { 67 localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); 68 } 69 } catch (e) { } 70 </script>
70 71 72 <!-- Set the theme before any content is loaded, prevents flash --> 73
73<script type="text/javascript"> 74 var theme; 75 try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } 76 if (theme === null || theme === undefined) { theme = default_theme; } 77 var html = document.querySelector('html'); 78 html.classList.remove('no-js') 79 html.classList.remove('light') 80 html.classList.add(theme); 81 html.classList.add('js'); 82 </script>
82 83 84 <!-- Hide / unhide sidebar before it is displayed --> 85
85<script type="text/javascript"> 86 var html = document.querySelector('html'); 87 var sidebar = 'hidden'; 88 if (document.body.clientWidth >= 1080) { 89 try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } 90 sidebar = sidebar || 'visible'; 91 } 92 html.classList.remove('sidebar-visible'); 93 html.classList.add("sidebar-" + sidebar); 94 </script>
94 95 96 <nav id="sidebar" class="sidebar" aria-label="Table of contents"> 97 <div class="sidebar-scrollbox"> 98 <ol class="chapter"><li class="chapter-item expanded "><a href='/welcome'><strong aria-hidden="true">1.</strong> Welcome</a></li><li class="chapter-item expanded "><a href='/guide'><strong aria-hidden="true">2.</strong> User's guide</a></li><li class="chapter-item expanded "><a href='/plumbing'><strong aria-hidden="true">3.</strong> Plumbing</a></li><li class="chapter-item expanded "><a class='active' href='/faq'><strong aria-hidden="true">4.</strong> FAQ</a></li></ol> 99 </div> 100 <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> 101 </nav> 102 103 <div id="page-wrapper" class="page-wrapper"> 104 105 <div class="page"> 106 107 <div id="menu-bar-hover-placeholder"></div> 108 <div id="menu-bar" class="menu-bar sticky bordered"> 109 <div class="left-buttons"> 110 <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> 111 <i class="fa fa-bars"></i> 112 </button> 113 <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"> 114 <i class="fa fa-paint-brush"></i> 115 </button> 116 <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> 117 <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> 118 <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> 119 <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> 120 <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> 121 <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> 122 </ul> 123 124 <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"> 125 <i class="fa fa-search"></i> 126 </button> 127 128 </div> 129 130 <h1 class="menu-title">Dyner - More dyn than ever</h1> 131 132 <div class="right-buttons"> 133 134 <a aria-label='Print this book' href='/print' title='Print this book'> 135 <i id="print-button" class="fa fa-print"></i> 136 </a> 137 138 139 <a href="https://github.com/nikomatsakis/dyner" title="Git repository" aria-label="Git repository"> 140 <i id="git-repository-button" class="fa fa-github"></i> 141 </a> 142 143 144 <a href="https://github.com/nikomatsakis/dyner/edit/master/src/FAQ.md" title="Suggest an edit" aria-label="Suggest an edit"> 145 <i id="git-edit-button" class="fa fa-edit"></i> 146 </a> 147 148 149 </div> 150 </div> 151 152 153 <div id="search-wrapper" class="hidden"> 154 <form id="searchbar-outer" class="searchbar-outer"> 155 <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> 156 </form> 157 <div id="searchresults-outer" class="searchresults-outer hidden"> 158 <div id="searchresults-header" class="searchresults-header"></div> 159 <ul id="searchresults"> 160 </ul> 161 </div> 162 </div> 163 164 165 <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> 166
166<script type="text/javascript"> 167 document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); 168 document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); 169 Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { 170 link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); 171 }); 172 </script>
172 173 174 <div id="content" class="content"> 175 <main> 176 <h1 id="faq"><a class="header" href="#faq">FAQ</a></h1> 177<h2 id="why-is-it-called-dyner"><a class="header" href="#why-is-it-called-dyner">Why is it called dyner?</a></h2> 178<p>Honestly? <a href="https://crates.io/crates/dyno">dyno</a> was taken. Best name ever! Think of the logo! It practically draws itself!</p> 179<p>But dyner is cool too: it's more dyn than dyn!</p> 180<h2 id="how-do-i-pronounce-dyner-dude"><a class="header" href="#how-do-i-pronounce-dyner-dude">How do I pronounce dyner, dude?</a></h2> 181<p>Pronounce it like "diner".</p> 182<p>Or maybe "dinner".</p> 183<p>Whatever floats your boat!</p> 184<h2 id="does-dyner-have-a-theme-song"><a class="header" href="#does-dyner-have-a-theme-song">Does dyner have a theme song?</a></h2> 185<p>Why, it does! So glad you asked! It goes to the tune of, "I've been working on the railroad".</p> 186<pre><code>I've been working on my rust code 187All the live long day 188Got a problem in my Rust code 189Static dispatch is in the way 190 191Too many copies of my function 192One for every type I use 193Mono-, monomorphization 194It's... so easy to abuse 195 196Dyner up my code 197Dyner up my code 198Dyner up the traits in my coh-oh-ode 199Dyner up my code 200Dyner up my code 201Dyner up the traits in my code 202 203Dynamic dispatch with dyner 204It's pretty easy to do-ooh-ooh 205Dynamic dispatch with dyner 206It's fun for me and you 207 208D, Y, N E R 209D, Y, N E R-R-R-R 210D, Y, N E-eeee Rrrrr 211Dynamic dispatch in my code 212</code></pre> 213<h2 id="does-dyner-work-for-no-std-crates"><a class="header" href="#does-dyner-work-for-no-std-crates">Does <code>dyner</code> work for no-std crates?</a></h2> 214<p>Yes! But without access to the <code>Box</code> type, you can only pass trait objects that are stored in references.</p> 215<h2 id="wouldnt-it-be-nicer-if-you-built-this-stuff-into-the-language"><a class="header" href="#wouldnt-it-be-nicer-if-you-built-this-stuff-into-the-language">Wouldn't it be nicer if you built this stuff into the language?</a></h2> 216<p>Maybe! But first we have to decide what we want to build. There are also some aspects of trait objects that are necessarily quite "custom", so it may be that there would still be a role for a crate like <code>dyner</code> even if we were to change how <code>dyn</code> works in Rust.</p> 217<h2 id="is-there-more-you-would-like-to-do-with-dyner"><a class="header" href="#is-there-more-you-would-like-to-do-with-dyner">Is there more you would like to do with dyner?</a></h2> 218<p>Yes! Here are some things we would like to support but haven't gotten around to yet:</p> 219<ul> 220<li>Supports for arbitrary smart pointers. In particular, it'd be great if you could use <code>from_ref</code> with anything <code>impl Deref<Target: Trait></code>, or at least any <code>impl Deref</code> that is pointer sized. Not clear how to best express or manage invoking the destructor.</li> 221<li>No-std compatibility! That... could be hard. It's not clear what's the best way to return a future if boxing is not available.</li> 222</ul> 223 224 </main> 225 226 <nav class="nav-wrapper" aria-label="Page navigation"> 227 <!-- Mobile navigation buttons --> 228 229 <a aria-keyshortcuts='Left' aria-label='Previous chapter' class='mobile-nav-chapters previous' href='/plumbing' rel='prev' title='Previous chapter'> 230 <i class="fa fa-angle-left"></i> 231 </a> 232 233 234 235 236 <div style="clear: both"></div> 237 </nav> 238 </div> 239 </div> 240 241 <nav class="nav-wide-wrapper" aria-label="Page navigation"> 242 243 <a aria-keyshortcuts='Left' aria-label='Previous chapter' class='nav-chapters previous' href='/plumbing' rel='prev' title='Previous chapter'> 244 <i class="fa fa-angle-left"></i> 245 </a> 246 247 248 249 </nav> 250 251 </div> 252 253 254 255 256 257 258 259 260
260<script type="text/javascript"> 261 window.playground_copyable = true; 262 </script>
262 263 264 265 266 267 268
268<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
268 269
269<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
269 270
270<script src="searcher.js" type="text/javascript" charset="utf-8"></script>
270 271 272 273
273<script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
273 274
274<script src="highlight.js" type="text/javascript" charset="utf-8"></script>
274 275
275<script src="book.js" type="text/javascript" charset="utf-8"></script>
275 276 277 <!-- Custom JS scripts --> 278 279 280 281 282 </body> 283</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.