Deploy 64e53a5502 to gh-pages

This commit is contained in:
Deploy from CI
2020-06-11 14:25:32 +00:00
commit dd4cea1b3d
4821 changed files with 579561 additions and 0 deletions

View File

@ -0,0 +1,3 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span>
</span>
<span class='in-band'>List of all items</span></h1><h3 id='Structs'>Structs</h3><ul class='structs docblock'><li><a href='struct.Clamped.html'>Clamped</a></li><li><a href='struct.JsStatic.html'>JsStatic</a></li><li><a href='struct.JsValue.html'>JsValue</a></li><li><a href='closure/struct.Closure.html'>closure::Closure</a></li><li><a href='convert/struct.Wasm64.html'>convert::Wasm64</a></li><li><a href='convert/struct.WasmOptional64.html'>convert::WasmOptional64</a></li><li><a href='convert/struct.WasmOptionalF32.html'>convert::WasmOptionalF32</a></li><li><a href='convert/struct.WasmOptionalF64.html'>convert::WasmOptionalF64</a></li><li><a href='convert/struct.WasmOptionalI32.html'>convert::WasmOptionalI32</a></li><li><a href='convert/struct.WasmOptionalU32.html'>convert::WasmOptionalU32</a></li><li><a href='convert/struct.WasmSlice.html'>convert::WasmSlice</a></li></ul><h3 id='Traits'>Traits</h3><ul class='traits docblock'><li><a href='trait.JsCast.html'>JsCast</a></li><li><a href='trait.UnwrapThrowExt.html'>UnwrapThrowExt</a></li><li><a href='convert/trait.FromWasmAbi.html'>convert::FromWasmAbi</a></li><li><a href='convert/trait.IntoWasmAbi.html'>convert::IntoWasmAbi</a></li><li><a href='convert/trait.OptionFromWasmAbi.html'>convert::OptionFromWasmAbi</a></li><li><a href='convert/trait.OptionIntoWasmAbi.html'>convert::OptionIntoWasmAbi</a></li><li><a href='convert/trait.RefFromWasmAbi.html'>convert::RefFromWasmAbi</a></li><li><a href='convert/trait.RefMutFromWasmAbi.html'>convert::RefMutFromWasmAbi</a></li><li><a href='convert/trait.ReturnWasmAbi.html'>convert::ReturnWasmAbi</a></li><li><a href='convert/trait.WasmAbi.html'>convert::WasmAbi</a></li></ul><h3 id='Attribute Macros'>Attribute Macros</h3><ul class='attributes docblock'><li><a href='prelude/attr.wasm_bindgen.html'>prelude::wasm_bindgen</a></li></ul><h3 id='Functions'>Functions</h3><ul class='functions docblock'><li><a href='fn.externref_heap_live_count.html'>externref_heap_live_count</a></li><li><a href='fn.function_table.html'>function_table</a></li><li><a href='fn.intern.html'>intern</a></li><li><a href='fn.memory.html'>memory</a></li><li><a href='fn.throw_str.html'>throw_str</a></li><li><a href='fn.throw_val.html'>throw_val</a></li><li><a href='fn.unintern.html'>unintern</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/fn.intern.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/fn.intern.html">../../../wasm_bindgen/fn.intern.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/fn.intern.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/fn.unintern.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/fn.unintern.html">../../../wasm_bindgen/fn.unintern.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/fn.unintern.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../wasm_bindgen/trait.JsCast.html">
</head>
<body>
<p>Redirecting to <a href="../../wasm_bindgen/trait.JsCast.html">../../wasm_bindgen/trait.JsCast.html</a>...</p>
<script>location.replace("../../wasm_bindgen/trait.JsCast.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `closure` mod in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, closure"><title>wasm_bindgen::closure - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module closure</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'closure', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#1-851' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>wasm_bindgen</a>::<wbr><a class="mod" href=''>closure</a></span></h1><div class='docblock'><p>Support for long-lived closures in <code>wasm-bindgen</code></p>
<p>This module defines the <code>Closure</code> type which is used to pass &quot;owned
closures&quot; from Rust to JS. Some more details can be found on the <code>Closure</code>
type itself.</p>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Closure.html" title='wasm_bindgen::closure::Closure struct'>Closure</a></td><td class='docblock-short'><p>A handle to both a closure in Rust as well as JS closure which will invoke
the Rust closure.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1 @@
initSidebarItems({"struct":[["Closure","A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure."]]});

View File

@ -0,0 +1,299 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Closure` struct in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, Closure"><title>wasm_bindgen::closure::Closure - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Closure</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.forget">forget</a><a href="#method.new">new</a><a href="#method.once">once</a><a href="#method.once_into_js">once_into_js</a><a href="#method.wrap">wrap</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-AsRef%3CJsValue%3E">AsRef&lt;JsValue&gt;</a><a href="#impl-Debug">Debug</a><a href="#impl-Drop">Drop</a><a href="#impl-IntoWasmAbi">IntoWasmAbi</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>closure</a></p><script>window.sidebarCurrent = {name: 'Closure', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#243-246' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>closure</a>::<wbr><a class="struct" href=''>Closure</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Closure&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; { /* fields omitted */ }</pre></div><div class='docblock'><p>A handle to both a closure in Rust as well as JS closure which will invoke
the Rust closure.</p>
<p>A <code>Closure</code> is the primary way that a <code>'static</code> lifetime closure is
transferred from Rust to JS. <code>Closure</code> currently requires that the closures
it's created with have the <code>'static</code> lifetime in Rust for soundness reasons.</p>
<p>This type is a &quot;handle&quot; in the sense that whenever it is dropped it will
invalidate the JS closure that it refers to. Any usage of the closure in JS
after the <code>Closure</code> has been dropped will raise an exception. It's then up
to you to arrange for <code>Closure</code> to be properly deallocate at an appropriate
location in your program.</p>
<p>The type parameter on <code>Closure</code> is the type of closure that this represents.
Currently this can only be the <code>Fn</code> and <code>FnMut</code> traits with up to 7
arguments (and an optional return value). The arguments/return value of the
trait must be numbers like <code>u32</code> for now, although this restriction may be
lifted in the future!</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>Here are a number of examples of using <code>Closure</code>.</p>
<h2 id="using-the-setinterval-api" class="section-header"><a href="#using-the-setinterval-api">Using the <code>setInterval</code> API</a></h2>
<p>Sample usage of <code>Closure</code> to invoke the <code>setInterval</code> API.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">extern</span> <span class="string">&quot;C&quot;</span> {
<span class="kw">fn</span> <span class="ident">setInterval</span>(<span class="ident">closure</span>: <span class="kw-2">&amp;</span><span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>, <span class="ident">time</span>: <span class="ident">u32</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">i32</span>;
<span class="kw">fn</span> <span class="ident">clearInterval</span>(<span class="ident">id</span>: <span class="ident">i32</span>);
<span class="attribute">#[<span class="ident">wasm_bindgen</span>(<span class="ident">js_namespace</span> <span class="op">=</span> <span class="ident">console</span>)]</span>
<span class="kw">fn</span> <span class="ident">log</span>(<span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>);
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">IntervalHandle</span> {
<span class="ident">interval_id</span>: <span class="ident">i32</span>,
<span class="ident">_closure</span>: <span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>,
}
<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">IntervalHandle</span> {
<span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="ident">clearInterval</span>(<span class="self">self</span>.<span class="ident">interval_id</span>);
}
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">run</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">IntervalHandle</span> {
<span class="comment">// First up we use `Closure::wrap` to wrap up a Rust closure and create</span>
<span class="comment">// a JS closure.</span>
<span class="kw">let</span> <span class="ident">cb</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">wrap</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="op">|</span><span class="op">|</span> {
<span class="ident">log</span>(<span class="string">&quot;interval elapsed!&quot;</span>);
}) <span class="kw">as</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>);
<span class="comment">// Next we pass this via reference to the `setInterval` function, and</span>
<span class="comment">// `setInterval` gets a handle to the corresponding JS closure.</span>
<span class="kw">let</span> <span class="ident">interval_id</span> <span class="op">=</span> <span class="ident">setInterval</span>(<span class="kw-2">&amp;</span><span class="ident">cb</span>, <span class="number">1_000</span>);
<span class="comment">// If we were to drop `cb` here it would cause an exception to be raised</span>
<span class="comment">// whenever the interval elapses. Instead we *return* our handle back to JS</span>
<span class="comment">// so JS can decide when to cancel the interval and deallocate the closure.</span>
<span class="ident">IntervalHandle</span> {
<span class="ident">interval_id</span>,
<span class="ident">_closure</span>: <span class="ident">cb</span>,
}
}</pre></div>
<h2 id="casting-a-closure-to-a-js_sysfunction" class="section-header"><a href="#casting-a-closure-to-a-js_sysfunction">Casting a <code>Closure</code> to a <code>js_sys::Function</code></a></h2>
<p>This is the same <code>setInterval</code> example as above, except it is using
<code>web_sys</code> (which uses <code>js_sys::Function</code> for callbacks) instead of manually
writing bindings to <code>setInterval</code> and other Web APIs.</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">JsCast</span>;
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">IntervalHandle</span> {
<span class="ident">interval_id</span>: <span class="ident">i32</span>,
<span class="ident">_closure</span>: <span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>,
}
<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">IntervalHandle</span> {
<span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="kw">let</span> <span class="ident">window</span> <span class="op">=</span> <span class="ident">web_sys</span>::<span class="ident">window</span>().<span class="ident">unwrap</span>();
<span class="ident">window</span>.<span class="ident">clear_interval_with_handle</span>(<span class="self">self</span>.<span class="ident">interval_id</span>);
}
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">run</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">IntervalHandle</span>, <span class="ident">JsValue</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">cb</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">wrap</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="op">|</span><span class="op">|</span> {
<span class="ident">web_sys</span>::<span class="ident">console</span>::<span class="ident">log_1</span>(<span class="kw-2">&amp;</span><span class="string">&quot;inverval elapsed!&quot;</span>.<span class="ident">into</span>());
}) <span class="kw">as</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>);
<span class="kw">let</span> <span class="ident">window</span> <span class="op">=</span> <span class="ident">web_sys</span>::<span class="ident">window</span>().<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">interval_id</span> <span class="op">=</span> <span class="ident">window</span>.<span class="ident">set_interval_with_callback_and_timeout_and_arguments_0</span>(
<span class="comment">// Note this method call, which uses `as_ref()` to get a `JsValue`</span>
<span class="comment">// from our `Closure` which is then converted to a `&amp;Function`</span>
<span class="comment">// using the `JsCast::unchecked_ref` function.</span>
<span class="ident">cb</span>.<span class="ident">as_ref</span>().<span class="ident">unchecked_ref</span>(),
<span class="number">1_000</span>,
)<span class="question-mark">?</span>;
<span class="comment">// Same as above.</span>
<span class="prelude-val">Ok</span>(<span class="ident">IntervalHandle</span> {
<span class="ident">interval_id</span>,
<span class="ident">_closure</span>: <span class="ident">cb</span>,
})
}</pre></div>
<h2 id="using-fnonce-and-closureonce-with-requestanimationframe" class="section-header"><a href="#using-fnonce-and-closureonce-with-requestanimationframe">Using <code>FnOnce</code> and <code>Closure::once</code> with <code>requestAnimationFrame</code></a></h2>
<p>Because <code>requestAnimationFrame</code> only calls its callback once, we can use
<code>FnOnce</code> and <code>Closure::once</code> with it.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">extern</span> <span class="string">&quot;C&quot;</span> {
<span class="kw">fn</span> <span class="ident">requestAnimationFrame</span>(<span class="ident">closure</span>: <span class="kw-2">&amp;</span><span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">u32</span>;
<span class="kw">fn</span> <span class="ident">cancelAnimationFrame</span>(<span class="ident">id</span>: <span class="ident">u32</span>);
<span class="attribute">#[<span class="ident">wasm_bindgen</span>(<span class="ident">js_namespace</span> <span class="op">=</span> <span class="ident">console</span>)]</span>
<span class="kw">fn</span> <span class="ident">log</span>(<span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>);
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">AnimationFrameHandle</span> {
<span class="ident">animation_id</span>: <span class="ident">u32</span>,
<span class="ident">_closure</span>: <span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>()<span class="op">&gt;</span>,
}
<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">AnimationFrameHandle</span> {
<span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="ident">cancelAnimationFrame</span>(<span class="self">self</span>.<span class="ident">animation_id</span>);
}
}
<span class="comment">// A type that will log a message when it is dropped.</span>
<span class="kw">struct</span> <span class="ident">LogOnDrop</span>(<span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span>);
<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">LogOnDrop</span> {
<span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="ident">log</span>(<span class="self">self</span>.<span class="number">0</span>);
}
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">run</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">AnimationFrameHandle</span> {
<span class="comment">// We are using `Closure::once` which takes a `FnOnce`, so the function</span>
<span class="comment">// can drop and/or move things that it closes over.</span>
<span class="kw">let</span> <span class="ident">fired</span> <span class="op">=</span> <span class="ident">LogOnDrop</span>(<span class="string">&quot;animation frame fired or canceled&quot;</span>);
<span class="kw">let</span> <span class="ident">cb</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">once</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> <span class="ident">drop</span>(<span class="ident">fired</span>));
<span class="comment">// Schedule the animation frame!</span>
<span class="kw">let</span> <span class="ident">animation_id</span> <span class="op">=</span> <span class="ident">requestAnimationFrame</span>(<span class="kw-2">&amp;</span><span class="ident">cb</span>);
<span class="comment">// Again, return a handle to JS, so that the closure is not dropped</span>
<span class="comment">// immediately and JS can decide whether to cancel the animation frame.</span>
<span class="ident">AnimationFrameHandle</span> {
<span class="ident">animation_id</span>,
<span class="ident">_closure</span>: <span class="ident">cb</span>,
}
}</pre></div>
<h2 id="converting-fnonces-directly-into-javascript-functions-with-closureonce_into_js" class="section-header"><a href="#converting-fnonces-directly-into-javascript-functions-with-closureonce_into_js">Converting <code>FnOnce</code>s directly into JavaScript Functions with <code>Closure::once_into_js</code></a></h2>
<p>If we don't want to allow a <code>FnOnce</code> to be eagerly dropped (maybe because we
just want it to drop after it is called and don't care about cancellation)
then we can use the <code>Closure::once_into_js</code> function.</p>
<p>This is the same <code>requestAnimationFrame</code> example as above, but without
supporting early cancellation.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">extern</span> <span class="string">&quot;C&quot;</span> {
<span class="comment">// We modify the binding to take an untyped `JsValue` since that is what</span>
<span class="comment">// is returned by `Closure::once_into_js`.</span>
<span class="comment">//</span>
<span class="comment">// If we were using the `web_sys` binding for `requestAnimationFrame`,</span>
<span class="comment">// then the call sites would cast the `JsValue` into a `&amp;js_sys::Function`</span>
<span class="comment">// using `f.unchecked_ref::&lt;js_sys::Function&gt;()`. See the `web_sys`</span>
<span class="comment">// example above for details.</span>
<span class="kw">fn</span> <span class="ident">requestAnimationFrame</span>(<span class="ident">callback</span>: <span class="ident">JsValue</span>);
<span class="attribute">#[<span class="ident">wasm_bindgen</span>(<span class="ident">js_namespace</span> <span class="op">=</span> <span class="ident">console</span>)]</span>
<span class="kw">fn</span> <span class="ident">log</span>(<span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>);
}
<span class="comment">// A type that will log a message when it is dropped.</span>
<span class="kw">struct</span> <span class="ident">LogOnDrop</span>(<span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span>);
<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">LogOnDrop</span> {
<span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="ident">log</span>(<span class="self">self</span>.<span class="number">0</span>);
}
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">run</span>() {
<span class="comment">// We are using `Closure::once_into_js` which takes a `FnOnce` and</span>
<span class="comment">// converts it into a JavaScript function, which is returned as a</span>
<span class="comment">// `JsValue`.</span>
<span class="kw">let</span> <span class="ident">fired</span> <span class="op">=</span> <span class="ident">LogOnDrop</span>(<span class="string">&quot;animation frame fired&quot;</span>);
<span class="kw">let</span> <span class="ident">cb</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">once_into_js</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> <span class="ident">drop</span>(<span class="ident">fired</span>));
<span class="comment">// Schedule the animation frame!</span>
<span class="ident">requestAnimationFrame</span>(<span class="ident">cb</span>);
<span class="comment">// No need to worry about whether or not we drop a `Closure`</span>
<span class="comment">// here or return some sort of handle to JS!</span>
}</pre></div>
</div><h2 id='implementations' class='small-section-header'>Implementations<a href='#implementations' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: WasmClosure,&nbsp;</span></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#253-376' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>&lt;F&gt;(t: F) -&gt; <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unsize.html" title="trait core::marker::Unsize">Unsize</a>&lt;T&gt; + 'static,&nbsp;</span></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#264-269' title='goto source code'>[src]</a></h4><div class='docblock'><p>A more ergonomic version of <code>Closure::wrap</code> that does the boxing and
cast to trait object for you.</p>
<p><em>This method requires the <code>nightly</code> feature of the <code>wasm-bindgen</code> crate
to be enabled, meaning this is a nightly-only API. Users on stable
should use <code>Closure::wrap</code>.</em></p>
</div><h4 id='method.wrap' class="method"><code id='wrap.v'>pub fn <a href='#method.wrap' class='fnname'>wrap</a>(data: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt;</code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#288-357' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new instance of <code>Closure</code> from the provided boxed Rust
function.</p>
<p>Note that the closure provided here, <code>Box&lt;T&gt;</code>, has a few requirements
associated with it:</p>
<ul>
<li>
<p>It must implement <code>Fn</code> or <code>FnMut</code> (for <code>FnOnce</code> functions see
<code>Closure::once</code> and <code>Closure::once_into_js</code>).</p>
</li>
<li>
<p>It must be <code>'static</code>, aka no stack references (use the <code>move</code>
keyword).</p>
</li>
<li>
<p>It can have at most 7 arguments.</p>
</li>
<li>
<p>Its arguments and return values are all types that can be shared with
JS (i.e. have <code>#[wasm_bindgen]</code> annotations or are simple numbers,
etc.)</p>
</li>
</ul>
</div><h4 id='method.forget' class="method"><code id='forget.v'>pub fn <a href='#method.forget' class='fnname'>forget</a>(self)</code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#370-375' title='goto source code'>[src]</a></h4><div class='docblock'><p>Leaks this <code>Closure</code> to ensure it remains valid for the duration of the
entire program.</p>
<blockquote>
<p><strong>Note</strong>: this function will leak memory. It should be used sparingly
to ensure the memory leak doesn't affect the program too much.</p>
</blockquote>
<p>When a <code>Closure</code> is dropped it will invalidate the associated JS
closure, but this isn't always desired. Some callbacks are alive for
the entire duration of the program, so this can be used to conveniently
leak this instance of <code>Closure</code> while performing as much internal
cleanup as it can.</p>
</div></div><h3 id='impl-1' class='impl'><code class='in-band'>impl <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>()&gt;</code><a href='#impl-1' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#381-443' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.once' class="method"><code id='once.v'>pub fn <a href='#method.once' class='fnname'>once</a>&lt;F, A, R&gt;(fn_once: F) -&gt; <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;F::FnMut&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: 'static + WasmClosureFnOnce&lt;A, R&gt;,&nbsp;</span></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#409-414' title='goto source code'>[src]</a></h4><div class='docblock'><p>Create a <code>Closure</code> from a function that can only be called once.</p>
<p>Since we have no way of enforcing that JS cannot attempt to call this
<code>FnOne(A...) -&gt; R</code> more than once, this produces a <code>Closure&lt;FnMut(A...) -&gt; R&gt;</code> that will dynamically throw a JavaScript error if called more
than once.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="comment">// Create an non-`Copy`, owned `String`.</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">s</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;Hello&quot;</span>);
<span class="comment">// Close over `s`. Since `f` returns `s`, it is `FnOnce` and can only be</span>
<span class="comment">// called once. If it was called a second time, it wouldn&#39;t have any `s`</span>
<span class="comment">// to work with anymore!</span>
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="kw">move</span> <span class="op">|</span><span class="op">|</span> {
<span class="ident">s</span> <span class="op">+</span><span class="op">=</span> <span class="string">&quot;, World!&quot;</span>;
<span class="ident">s</span>
};
<span class="comment">// Create a `Closure` from `f`. Note that the `Closure`&#39;s type parameter</span>
<span class="comment">// is `FnMut`, even though `f` is `FnOnce`.</span>
<span class="kw">let</span> <span class="ident">closure</span>: <span class="ident">Closure</span><span class="op">&lt;</span><span class="ident">FnMut</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">once</span>(<span class="ident">f</span>);</pre></div>
</div><h4 id='method.once_into_js' class="method"><code id='once_into_js.v'>pub fn <a href='#method.once_into_js' class='fnname'>once_into_js</a>&lt;F, A, R&gt;(fn_once: F) -&gt; <a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: 'static + WasmClosureFnOnce&lt;A, R&gt;,&nbsp;</span></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#437-442' title='goto source code'>[src]</a></h4><div class='docblock'><p>Convert a <code>FnOnce(A...) -&gt; R</code> into a JavaScript <code>Function</code> object.</p>
<p>If the JavaScript function is invoked more than once, it will throw an
exception.</p>
<p>Unlike <code>Closure::once</code>, this does <em>not</em> return a <code>Closure</code> that can be
dropped before the function is invoked to deallocate the closure. The
only way the <code>FnOnce</code> is deallocated is by calling the JavaScript
function. If the JavaScript function is never called then the <code>FnOnce</code>
and everything it closes over will leak.</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">use</span> <span class="ident">js_sys</span>;
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::{<span class="ident">prelude</span>::<span class="kw-2">*</span>, <span class="ident">JsCast</span>};
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">Closure</span>::<span class="ident">once_into_js</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> {
<span class="comment">// ...</span>
});
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">f</span>.<span class="ident">is_instance_of</span>::<span class="op">&lt;</span><span class="ident">js_sys</span>::<span class="ident">Function</span><span class="op">&gt;</span>());</pre></div>
</div></div><h2 id='trait-implementations' class='small-section-header'>Trait Implementations<a href='#trait-implementations' class='anchor'></a></h2><div id='trait-implementations-list'><h3 id='impl-AsRef%3CJsValue%3E' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>&gt; for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt;</code><a href='#impl-AsRef%3CJsValue%3E' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#456-460' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.as_ref' class="method hidden"><code id='as_ref.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#457-459' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#493-500' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#497-499' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-Drop' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Drop' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#502-515' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.drop' class="method hidden"><code id='drop.v'>fn <a href='https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#506-514' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
</div></div><h3 id='impl-IntoWasmAbi' class='impl'><code class='in-band'>impl&lt;'a, T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html" title="trait wasm_bindgen::convert::IntoWasmAbi">IntoWasmAbi</a> for &amp;'a <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: WasmClosure,&nbsp;</span></code><a href='#impl-IntoWasmAbi' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#472-481' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi' class="type"><code id='Abi.t'>type <a href='../../wasm_bindgen/convert/trait.IntoWasmAbi.html#associatedtype.Abi' class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></h4><div class='docblock'><p>The wasm ABI type that this converts into when crossing the ABI boundary. <a href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html#associatedtype.Abi">Read more</a></p>
</div><h4 id='method.into_abi' class="method hidden"><code id='into_abi.v'>fn <a href='../../wasm_bindgen/convert/trait.IntoWasmAbi.html#tymethod.into_abi' class='fnname'>into_abi</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a class='srclink' href='../../src/wasm_bindgen/closure.rs.html#478-480' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Convert <code>self</code> into <code>Self::Abi</code> so that it can be sent across the wasm ABI boundary. <a href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html#tymethod.into_abi">Read more</a></p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a>,&nbsp;</span></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl&lt;T&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt;</code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl&lt;T&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt;</code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt;</code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a>,&nbsp;</span></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-569' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#566-568' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#554-561' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#558-560' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#602-611' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#608-610' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588-597' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#594-596' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.Wasm64.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.Wasm64.html">../../../wasm_bindgen/convert/struct.Wasm64.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.Wasm64.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmOptional64.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmOptional64.html">../../../wasm_bindgen/convert/struct.WasmOptional64.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmOptional64.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmOptionalF32.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmOptionalF32.html">../../../wasm_bindgen/convert/struct.WasmOptionalF32.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmOptionalF32.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmOptionalF64.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmOptionalF64.html">../../../wasm_bindgen/convert/struct.WasmOptionalF64.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmOptionalF64.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmOptionalI32.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmOptionalI32.html">../../../wasm_bindgen/convert/struct.WasmOptionalI32.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmOptionalI32.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmOptionalU32.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmOptionalU32.html">../../../wasm_bindgen/convert/struct.WasmOptionalU32.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmOptionalU32.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `convert` mod in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, convert"><title>wasm_bindgen::convert - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module convert</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'><a href='../index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'convert', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/convert/mod.rs.html#1-11' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>wasm_bindgen</a>::<wbr><a class="mod" href=''>convert</a></span></h1><div class='docblock'><p>This is mostly an internal module, no stability guarantees are provided. Use
at your own risk.</p>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Wasm64.html" title='wasm_bindgen::convert::Wasm64 struct'>Wasm64</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmOptional64.html" title='wasm_bindgen::convert::WasmOptional64 struct'>WasmOptional64</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmOptionalF32.html" title='wasm_bindgen::convert::WasmOptionalF32 struct'>WasmOptionalF32</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmOptionalF64.html" title='wasm_bindgen::convert::WasmOptionalF64 struct'>WasmOptionalF64</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmOptionalI32.html" title='wasm_bindgen::convert::WasmOptionalI32 struct'>WasmOptionalI32</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmOptionalU32.html" title='wasm_bindgen::convert::WasmOptionalU32 struct'>WasmOptionalU32</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.WasmSlice.html" title='wasm_bindgen::convert::WasmSlice struct'>WasmSlice</a></td><td class='docblock-short'></td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.FromWasmAbi.html" title='wasm_bindgen::convert::FromWasmAbi trait'>FromWasmAbi</a></td><td class='docblock-short'><p>A trait for anything that can be recovered by-value from the wasm ABI
boundary, eg a Rust <code>u8</code> can be recovered from the wasm ABI <code>u32</code> type.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IntoWasmAbi.html" title='wasm_bindgen::convert::IntoWasmAbi trait'>IntoWasmAbi</a></td><td class='docblock-short'><p>A trait for anything that can be converted into a type that can cross the
wasm ABI directly, eg <code>u32</code> or <code>f64</code>.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.OptionFromWasmAbi.html" title='wasm_bindgen::convert::OptionFromWasmAbi trait'>OptionFromWasmAbi</a></td><td class='docblock-short'><p>Indicates that this type can be received from JS as <code>Option&lt;Self&gt;</code>.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.OptionIntoWasmAbi.html" title='wasm_bindgen::convert::OptionIntoWasmAbi trait'>OptionIntoWasmAbi</a></td><td class='docblock-short'><p>Indicates that this type can be passed to JS as <code>Option&lt;Self&gt;</code>.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.RefFromWasmAbi.html" title='wasm_bindgen::convert::RefFromWasmAbi trait'>RefFromWasmAbi</a></td><td class='docblock-short'><p>A trait for anything that can be recovered as some sort of shared reference
from the wasm ABI boundary.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.RefMutFromWasmAbi.html" title='wasm_bindgen::convert::RefMutFromWasmAbi trait'>RefMutFromWasmAbi</a></td><td class='docblock-short'><p>Dual of the <code>RefFromWasmAbi</code> trait, except for mutable references.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.ReturnWasmAbi.html" title='wasm_bindgen::convert::ReturnWasmAbi trait'>ReturnWasmAbi</a></td><td class='docblock-short'><p>A trait representing how to interepret the return value of a function for
the wasm ABI.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.WasmAbi.html" title='wasm_bindgen::convert::WasmAbi trait'>WasmAbi</a></td><td class='docblock-short'><p>An unsafe trait which represents types that are ABI-safe to pass via wasm
arguments.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1 @@
initSidebarItems({"struct":[["Wasm64",""],["WasmOptional64",""],["WasmOptionalF32",""],["WasmOptionalF64",""],["WasmOptionalI32",""],["WasmOptionalU32",""],["WasmSlice",""]],"trait":[["FromWasmAbi","A trait for anything that can be recovered by-value from the wasm ABI boundary, eg a Rust `u8` can be recovered from the wasm ABI `u32` type."],["IntoWasmAbi","A trait for anything that can be converted into a type that can cross the wasm ABI directly, eg `u32` or `f64`."],["OptionFromWasmAbi","Indicates that this type can be received from JS as `Option<Self>`."],["OptionIntoWasmAbi","Indicates that this type can be passed to JS as `Option<Self>`."],["RefFromWasmAbi","A trait for anything that can be recovered as some sort of shared reference from the wasm ABI boundary."],["RefMutFromWasmAbi","Dual of the `RefFromWasmAbi` trait, except for mutable references."],["ReturnWasmAbi","A trait representing how to interepret the return value of a function for the wasm ABI."],["WasmAbi","An unsafe trait which represents types that are ABI-safe to pass via wasm arguments."]]});

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/struct.WasmSlice.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/struct.WasmSlice.html">../../../wasm_bindgen/convert/struct.WasmSlice.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/struct.WasmSlice.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Wasm64` struct in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, Wasm64"><title>wasm_bindgen::convert::Wasm64 - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Wasm64</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.high">high</a><a href="#structfield.low">low</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-WasmAbi">WasmAbi</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a></p><script>window.sidebarCurrent = {name: 'Wasm64', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#44-47' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a>::<wbr><a class="struct" href=''>Wasm64</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'><span class="docblock attributes top-attr">#[repr(C)]</span>pub struct Wasm64 {
pub low: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
pub high: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
}</pre></div><h2 id='fields' class='fields small-section-header'>
Fields<a href='#fields' class='anchor'></a></h2><span id="structfield.low" class="structfield small-section-header"><a href="#structfield.low" class="anchor field"></a><code id="low.v">low: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></span><span id="structfield.high" class="structfield small-section-header"><a href="#structfield.high" class="anchor field"></a><code id="high.v">high: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></span><h2 id='trait-implementations' class='small-section-header'>Trait Implementations<a href='#trait-implementations' class='anchor'></a></h2><div id='trait-implementations-list'><h3 id='impl-WasmAbi' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-WasmAbi' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#49' title='goto source code'>[src]</a></h3><div class='impl-items'></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-569' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#566-568' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#554-561' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#558-560' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#602-611' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#608-610' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588-597' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#594-596' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ReturnWasmAbi` trait in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, ReturnWasmAbi"><title>wasm_bindgen::convert::ReturnWasmAbi - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait ReturnWasmAbi</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Abi">Abi</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.return_abi">return_abi</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-ReturnWasmAbi-for-Result%3CT%2C%20JsValue%3E">Result&lt;T, JsValue&gt;</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a></p><script>window.sidebarCurrent = {name: 'ReturnWasmAbi', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#113-120' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a>::<wbr><a class="trait" href=''>ReturnWasmAbi</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait ReturnWasmAbi: WasmDescribe {
type <a href='#associatedtype.Abi' class="type">Abi</a>: <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a>;
fn <a href='#tymethod.return_abi' class='fnname'>return_abi</a>(self) -&gt; Self::<a class="type" href="../../wasm_bindgen/convert/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::ReturnWasmAbi::Abi">Abi</a>;
}</pre></div><div class='docblock'><p>A trait representing how to interepret the return value of a function for
the wasm ABI.</p>
<p>This is very similar to the <code>IntoWasmAbi</code> trait and in fact has a blanket
implementation for all implementors of the <code>IntoWasmAbi</code>. The primary use
case of this trait is to enable functions to return <code>Result</code>, interpreting
an error as &quot;rethrow this to JS&quot;</p>
</div>
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Abi' class='method'><code id='Abi.t'>type <a href='#associatedtype.Abi' class="type">Abi</a>: <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a></code></h3><div class='docblock'><p>Same as <code>IntoWasmAbi::Abi</code></p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.return_abi' class='method'><code id='return_abi.v'>fn <a href='#tymethod.return_abi' class='fnname'>return_abi</a>(self) -&gt; Self::<a class="type" href="../../wasm_bindgen/convert/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::ReturnWasmAbi::Abi">Abi</a></code></h3><div class='docblock'><p>Same as <code>IntoWasmAbi::into_abi</code>, except that it may throw and never
return in the case of <code>Err</code>.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-ReturnWasmAbi-for-Result%3CT%2C%20JsValue%3E' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html" title="trait wasm_bindgen::convert::IntoWasmAbi">IntoWasmAbi</a>&gt; <a class="trait" href="../../wasm_bindgen/convert/trait.ReturnWasmAbi.html" title="trait wasm_bindgen::convert::ReturnWasmAbi">ReturnWasmAbi</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>&gt;</code><a href='#impl-ReturnWasmAbi-for-Result%3CT%2C%20JsValue%3E' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#399-409' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi-1' class="type"><code id='Abi.t-1'>type <a href='#associatedtype.Abi' class="type">Abi</a> = T::<a class="type" href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::IntoWasmAbi::Abi">Abi</a></code></h4><h4 id='method.return_abi' class="method hidden"><code id='return_abi.v-1'>fn <a href='#method.return_abi' class='fnname'>return_abi</a>(self) -&gt; Self::<a class="type" href="../../wasm_bindgen/convert/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::ReturnWasmAbi::Abi">Abi</a></code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#403-408' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-ReturnWasmAbi' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html" title="trait wasm_bindgen::convert::IntoWasmAbi">IntoWasmAbi</a>&gt; ReturnWasmAbi for T</code><a href='#impl-ReturnWasmAbi' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#122-129' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi-2' class="type"><code id='Abi.t-2'>type <a href='#associatedtype.Abi-2' class="type">Abi</a> = T::<a class="type" href="../../wasm_bindgen/convert/trait.IntoWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::IntoWasmAbi::Abi">Abi</a></code></h4><h4 id='method.return_abi-1' class="method hidden"><code id='return_abi.v-2'>fn <a href='#method.return_abi-1' class='fnname'>return_abi</a>(self) -&gt; Self::<a class="type" href="../../wasm_bindgen/convert/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::ReturnWasmAbi::Abi">Abi</a></code><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#126-128' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../../implementors/wasm_bindgen/convert/trait.ReturnWasmAbi.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `WasmAbi` trait in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, WasmAbi"><title>wasm_bindgen::convert::WasmAbi - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait WasmAbi</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-WasmAbi-for-()">()</a><a href="#impl-WasmAbi-for-f32">f32</a><a href="#impl-WasmAbi-for-f64">f64</a><a href="#impl-WasmAbi-for-i32">i32</a><a href="#impl-WasmAbi-for-u32">u32</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a></p><script>window.sidebarCurrent = {name: 'WasmAbi', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#99' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>convert</a>::<wbr><a class="trait" href=''>WasmAbi</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub unsafe trait WasmAbi { }</pre></div><div class='docblock'><p>An unsafe trait which represents types that are ABI-safe to pass via wasm
arguments.</p>
<p>This is an unsafe trait to implement as there's no guarantee the type is
actually safe to transfer across the was boundary, it's up to you to
guarantee this so codegen works correctly.</p>
</div>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-WasmAbi-for-()' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></code><a href='#impl-WasmAbi-for-()' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#9' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-for-u32' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a href='#impl-WasmAbi-for-u32' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#101' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-for-i32' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code><a href='#impl-WasmAbi-for-i32' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#102' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-for-f32' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code><a href='#impl-WasmAbi-for-f32' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#103' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-for-f64' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.WasmAbi.html" title="trait wasm_bindgen::convert::WasmAbi">WasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code><a href='#impl-WasmAbi-for-f64' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/traits.rs.html#104' title='goto source code'>[src]</a></h3><div class='impl-items'></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-WasmAbi' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.Wasm64.html" title="struct wasm_bindgen::convert::Wasm64">Wasm64</a></code><a href='#impl-WasmAbi' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#49' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-1' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptional64.html" title="struct wasm_bindgen::convert::WasmOptional64">WasmOptional64</a></code><a href='#impl-WasmAbi-1' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#58' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-2' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalF32.html" title="struct wasm_bindgen::convert::WasmOptionalF32">WasmOptionalF32</a></code><a href='#impl-WasmAbi-2' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#33' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-3' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalF64.html" title="struct wasm_bindgen::convert::WasmOptionalF64">WasmOptionalF64</a></code><a href='#impl-WasmAbi-3' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#41' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-4' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalI32.html" title="struct wasm_bindgen::convert::WasmOptionalI32">WasmOptionalI32</a></code><a href='#impl-WasmAbi-4' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#17' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-5' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalU32.html" title="struct wasm_bindgen::convert::WasmOptionalU32">WasmOptionalU32</a></code><a href='#impl-WasmAbi-5' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#25' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-WasmAbi-6' class='impl'><code class='in-band'>impl WasmAbi for <a class="struct" href="../../wasm_bindgen/convert/struct.WasmSlice.html" title="struct wasm_bindgen::convert::WasmSlice">WasmSlice</a></code><a href='#impl-WasmAbi-6' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/slices.rs.html#22' title='goto source code'>[src]</a></h3><div class='impl-items'></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../../implementors/wasm_bindgen/convert/trait.WasmAbi.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.FromWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.FromWasmAbi.html">../../../wasm_bindgen/convert/trait.FromWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.FromWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.IntoWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.IntoWasmAbi.html">../../../wasm_bindgen/convert/trait.IntoWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.IntoWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.OptionFromWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.OptionFromWasmAbi.html">../../../wasm_bindgen/convert/trait.OptionFromWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.OptionFromWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.OptionIntoWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.OptionIntoWasmAbi.html">../../../wasm_bindgen/convert/trait.OptionIntoWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.OptionIntoWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.RefFromWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.RefFromWasmAbi.html">../../../wasm_bindgen/convert/trait.RefFromWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.RefFromWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.RefMutFromWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.RefMutFromWasmAbi.html">../../../wasm_bindgen/convert/trait.RefMutFromWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.RefMutFromWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.ReturnWasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.ReturnWasmAbi.html">../../../wasm_bindgen/convert/trait.ReturnWasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.ReturnWasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../wasm_bindgen/convert/trait.WasmAbi.html">
</head>
<body>
<p>Redirecting to <a href="../../../wasm_bindgen/convert/trait.WasmAbi.html">../../../wasm_bindgen/convert/trait.WasmAbi.html</a>...</p>
<script>location.replace("../../../wasm_bindgen/convert/trait.WasmAbi.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `externref_heap_live_count` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, externref_heap_live_count"><title>wasm_bindgen::externref_heap_live_count - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'externref_heap_live_count', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#706-708' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>externref_heap_live_count</a></span></h1><pre class='rust fn'>pub fn externref_heap_live_count() -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></pre><div class='docblock'><p>Get the count of live <code>externref</code>s / <code>JsValue</code>s in <code>wasm-bindgen</code>'s heap.</p>
<h2 id="usage" class="section-header"><a href="#usage">Usage</a></h2>
<p>This is intended for debugging and writing tests.</p>
<p>To write a test that asserts against unnecessarily keeping <code>anref</code>s /
<code>JsValue</code>s alive:</p>
<ul>
<li>
<p>get an initial live count,</p>
</li>
<li>
<p>perform some series of operations or function calls that should clean up
after themselves, and should not keep holding onto <code>externref</code>s / <code>JsValue</code>s
after completion,</p>
</li>
<li>
<p>get the final live count,</p>
</li>
<li>
<p>and assert that the initial and final counts are the same.</p>
</li>
</ul>
<h2 id="what-is-counted" class="section-header"><a href="#what-is-counted">What is Counted</a></h2>
<p>Note that this only counts the <em>owned</em> <code>externref</code>s / <code>JsValue</code>s that end up in
<code>wasm-bindgen</code>'s heap. It does not count borrowed <code>externref</code>s / <code>JsValue</code>s
that are on its stack.</p>
<p>For example, these <code>JsValue</code>s are accounted for:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">my_function</span>(<span class="ident">this_is_counted</span>: <span class="ident">JsValue</span>) {
<span class="kw">let</span> <span class="ident">also_counted</span> <span class="op">=</span> <span class="ident">JsValue</span>::<span class="ident">from_str</span>(<span class="string">&quot;hi&quot;</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">wasm_bindgen</span>::<span class="ident">externref_heap_live_count</span>() <span class="op">&gt;</span><span class="op">=</span> <span class="number">2</span>);
}</pre></div>
<p>While this borrowed <code>JsValue</code> ends up on the stack, not the heap, and
therefore is not accounted for:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">my_other_function</span>(<span class="ident">this_is_not_counted</span>: <span class="kw-2">&amp;</span><span class="ident">JsValue</span>) {
<span class="comment">// ...</span>
}</pre></div>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,3 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `function_table` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, function_table"><title>wasm_bindgen::function_table - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'function_table', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#804-806' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>function_table</a></span></h1><pre class='rust fn'>pub fn function_table() -&gt; <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></pre><div class='docblock'><p>Returns a handle to this wasm instance's <code>WebAssembly.Table</code> which is the
indirect function table used by Rust</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `intern` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, intern"><title>wasm_bindgen::intern - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'intern', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/cache/intern.rs.html#85-90' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>intern</a></span></h1><pre class='rust fn'>pub fn intern(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></pre><div class='docblock'><p>Interns Rust strings so that it's much faster to send them to JS.</p>
<p>Sending strings from Rust to JS is slow, because it has to do a full <code>O(n)</code>
copy and <em>also</em> encode from UTF-8 to UTF-16. This must be done every single
time a string is sent to JS.</p>
<p>If you are sending the same string multiple times, you can call this <code>intern</code>
function, which simply returns its argument unchanged:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">intern</span>(<span class="string">&quot;foo&quot;</span>) <span class="comment">// returns &quot;foo&quot;</span></pre></div>
<p>However, if you enable the <code>&quot;enable-interning&quot;</code> feature for wasm-bindgen,
then it will add the string into an internal cache.</p>
<p>When you send that cached string to JS, it will look it up in the cache,
which completely avoids the <code>O(n)</code> copy and encoding. This has a significant
speed boost (as high as 783%)!</p>
<p>However, there is a small cost to this caching, so you shouldn't cache every
string. Only cache strings which have a high likelihood of being sent
to JS multiple times.</p>
<p>Also, keep in mind that this function is a <em>performance hint</em>: it's not
<em>guaranteed</em> that the string will be cached, and the caching strategy
might change at any time, so don't rely upon it.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `memory` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, memory"><title>wasm_bindgen::memory - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'memory', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#798-800' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>memory</a></span></h1><pre class='rust fn'>pub fn memory() -&gt; <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></pre><div class='docblock'><p>Returns a handle to this wasm instance's <code>WebAssembly.Memory</code></p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `throw_str` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, throw_str"><title>wasm_bindgen::throw_str - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'throw_str', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#636-640' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>throw_str</a></span></h1><pre class='rust fn'>pub fn throw_str(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.never.html">!</a></pre><div class='docblock'><p>Throws a JS exception.</p>
<p>This function will throw a JS exception with the message provided. The
function will not return as the wasm stack will be popped when the exception
is thrown.</p>
<p>Note that it is very easy to leak memory with this function because this
function, unlike <code>panic!</code> on other platforms, <strong>will not run destructors</strong>.
It's recommended to return a <code>Result</code> where possible to avoid the worry of
leaks.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `throw_val` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, throw_val"><title>wasm_bindgen::throw_val - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'throw_val', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#654-660' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>throw_val</a></span></h1><pre class='rust fn'>pub fn throw_val(s: <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.never.html">!</a></pre><div class='docblock'><p>Rethrow a JS exception</p>
<p>This function will throw a JS exception with the JS value provided. This
function will not return and the wasm stack will be popped until the point
of entry of wasm itself.</p>
<p>Note that it is very easy to leak memory with this function because this
function, unlike <code>panic!</code> on other platforms, <strong>will not run destructors</strong>.
It's recommended to return a <code>Result</code> where possible to avoid the worry of
leaks.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `unintern` fn in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, unintern"><title>wasm_bindgen::unintern - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'unintern', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/cache/intern.rs.html#100-103' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>wasm_bindgen</a>::<wbr><a class="fn" href=''>unintern</a></span></h1><pre class='rust fn'>pub fn unintern(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>)</pre><div class='docblock'><p>Removes a Rust string from the intern cache.</p>
<p>This does the opposite of the <a href="fn.intern.html"><code>intern</code></a> function.</p>
<p>If the <a href="fn.intern.html"><code>intern</code></a> function is called again then it will re-intern the string.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `wasm_bindgen` crate."><meta name="keywords" content="rust, rustlang, rust-lang, wasm_bindgen"><title>wasm_bindgen - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate wasm_bindgen</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all wasm_bindgen's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'wasm_bindgen', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#1-1174' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>wasm_bindgen</a></span></h1><div class='docblock'><p>Runtime support for the <code>wasm-bindgen</code> tool</p>
<p>This crate contains the runtime support necessary for <code>wasm-bindgen</code> the
attribute and tool. Crates pull in the <code>#[wasm_bindgen]</code> attribute through
this crate and this crate also provides JS bindings through the <code>JsValue</code>
interface.</p>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table><tr class='module-item'><td><a class="mod" href="closure/index.html" title='wasm_bindgen::closure mod'>closure</a></td><td class='docblock-short'><p>Support for long-lived closures in <code>wasm-bindgen</code></p>
</td></tr><tr class='module-item'><td><a class="mod" href="convert/index.html" title='wasm_bindgen::convert mod'>convert</a></td><td class='docblock-short'><p>This is mostly an internal module, no stability guarantees are provided. Use
at your own risk.</p>
</td></tr><tr class='module-item'><td><a class="mod" href="prelude/index.html" title='wasm_bindgen::prelude mod'>prelude</a></td><td class='docblock-short'><p>A module which is typically glob imported from:</p>
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Clamped.html" title='wasm_bindgen::Clamped struct'>Clamped</a></td><td class='docblock-short'><p>A wrapper type around slices and vectors for binding the <code>Uint8ClampedArray</code>
array in JS.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.JsStatic.html" title='wasm_bindgen::JsStatic struct'>JsStatic</a></td><td class='docblock-short'><p>Wrapper type for imported statics.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.JsValue.html" title='wasm_bindgen::JsValue struct'>JsValue</a></td><td class='docblock-short'><p>Representation of an object owned by JS.</p>
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.JsCast.html" title='wasm_bindgen::JsCast trait'>JsCast</a></td><td class='docblock-short'><p>A trait for checked and unchecked casting between JS types.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.UnwrapThrowExt.html" title='wasm_bindgen::UnwrapThrowExt trait'>UnwrapThrowExt</a></td><td class='docblock-short'><p>An extension trait for <code>Option&lt;T&gt;</code> and <code>Result&lt;T, E&gt;</code> for unwraping the <code>T</code>
value, or throwing a JS error if it is not available.</p>
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
<table><tr class='module-item'><td><a class="fn" href="fn.externref_heap_live_count.html" title='wasm_bindgen::externref_heap_live_count fn'>externref_heap_live_count</a></td><td class='docblock-short'><p>Get the count of live <code>externref</code>s / <code>JsValue</code>s in <code>wasm-bindgen</code>'s heap.</p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.function_table.html" title='wasm_bindgen::function_table fn'>function_table</a></td><td class='docblock-short'><p>Returns a handle to this wasm instance's <code>WebAssembly.Table</code> which is the
indirect function table used by Rust</p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.intern.html" title='wasm_bindgen::intern fn'>intern</a></td><td class='docblock-short'><p>Interns Rust strings so that it's much faster to send them to JS.</p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.memory.html" title='wasm_bindgen::memory fn'>memory</a></td><td class='docblock-short'><p>Returns a handle to this wasm instance's <code>WebAssembly.Memory</code></p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.throw_str.html" title='wasm_bindgen::throw_str fn'>throw_str</a></td><td class='docblock-short'><p>Throws a JS exception.</p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.throw_val.html" title='wasm_bindgen::throw_val fn'>throw_val</a></td><td class='docblock-short'><p>Rethrow a JS exception</p>
</td></tr><tr class='module-item'><td><a class="fn" href="fn.unintern.html" title='wasm_bindgen::unintern fn'>unintern</a></td><td class='docblock-short'><p>Removes a Rust string from the intern cache.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `wasm_bindgen` attr in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, wasm_bindgen"><title>wasm_bindgen::prelude::wasm_bindgen - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc attr"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>prelude</a></p><script>window.sidebarCurrent = {name: 'wasm_bindgen', ty: 'attr', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='https://docs.rs/wasm-bindgen-macro/0.2/src/wasm_bindgen_macro/lib.rs.html#9-19' title='goto source code'>[src]</a></span><span class='in-band'>Attribute Macro <a href='../index.html'>wasm_bindgen</a>::<wbr><a href='index.html'>prelude</a>::<wbr><a class="attr" href=''>wasm_bindgen</a></span></h1><pre class='rust attr'>#[wasm_bindgen]</pre></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `prelude` mod in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, prelude"><title>wasm_bindgen::prelude - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../wasm_bindgen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module prelude</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#reexports">Re-exports</a></li></ul></div><p class='location'><a href='../index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'prelude', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/wasm_bindgen/lib.rs.html#49-59' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>wasm_bindgen</a>::<wbr><a class="mod" href=''>prelude</a></span></h1><div class='docblock'><p>A module which is typically glob imported from:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;</pre></div>
</div><h2 id='reexports' class='section-header'><a href="#reexports">Re-exports</a></h2>
<table><tr><td><code>pub use crate::<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>;</code></td></tr><tr><td><code>pub use crate::<a class="trait" href="../../wasm_bindgen/trait.UnwrapThrowExt.html" title="trait wasm_bindgen::UnwrapThrowExt">UnwrapThrowExt</a>;</code></td></tr><tr><td><code>pub use crate::closure::<a class="struct" href="../../wasm_bindgen/closure/struct.Closure.html" title="struct wasm_bindgen::closure::Closure">Closure</a>;</code></td></tr></table><h2 id='attributes' class='section-header'><a href="#attributes">Attribute Macros</a></h2>
<table><tr class='module-item'><td><a class="attr" href="attr.wasm_bindgen.html" title='wasm_bindgen::prelude::wasm_bindgen attr'>wasm_bindgen</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "wasm_bindgen";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@ -0,0 +1 @@
initSidebarItems({"attr":[["wasm_bindgen",""]]});

View File

@ -0,0 +1 @@
initSidebarItems({"fn":[["externref_heap_live_count","Get the count of live `externref`s / `JsValue`s in `wasm-bindgen`'s heap."],["function_table","Returns a handle to this wasm instance's `WebAssembly.Table` which is the indirect function table used by Rust"],["intern","Interns Rust strings so that it's much faster to send them to JS."],["memory","Returns a handle to this wasm instance's `WebAssembly.Memory`"],["throw_str","Throws a JS exception."],["throw_val","Rethrow a JS exception"],["unintern","Removes a Rust string from the intern cache."]],"mod":[["closure","Support for long-lived closures in `wasm-bindgen`"],["convert","This is mostly an internal module, no stability guarantees are provided. Use at your own risk."],["prelude","A module which is typically glob imported from:"]],"struct":[["Clamped","A wrapper type around slices and vectors for binding the `Uint8ClampedArray` array in JS."],["JsStatic","Wrapper type for imported statics."],["JsValue","Representation of an object owned by JS."]],"trait":[["JsCast","A trait for checked and unchecked casting between JS types."],["UnwrapThrowExt","An extension trait for `Option<T>` and `Result<T, E>` for unwraping the `T` value, or throwing a JS error if it is not available."]]});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,27 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `JsStatic` struct in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, JsStatic"><title>wasm_bindgen::JsStatic - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct JsStatic</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Deref">Deref</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'JsStatic', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#595-598' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>wasm_bindgen</a>::<wbr><a class="struct" href=''>JsStatic</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct JsStatic&lt;T:&nbsp;'static&gt; { /* fields omitted */ }</pre></div><div class='docblock'><p>Wrapper type for imported statics.</p>
<p>This type is used whenever a <code>static</code> is imported from a JS module, for
example this import:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">extern</span> <span class="string">&quot;C&quot;</span> {
<span class="kw">static</span> <span class="ident">console</span>: <span class="ident">JsValue</span>;
}</pre></div>
<p>will generate in Rust a value that looks like:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">static</span> <span class="ident">console</span>: <span class="ident">JsStatic</span><span class="op">&lt;</span><span class="ident">JsValue</span><span class="op">&gt;</span> <span class="op">=</span> ...;</pre></div>
<p>This type implements <code>Deref</code> to the inner type so it's typically used as if
it were <code>&amp;T</code>.</p>
</div><h2 id='trait-implementations' class='small-section-header'>Trait Implementations<a href='#trait-implementations' class='anchor'></a></h2><div id='trait-implementations-list'><h3 id='impl-Deref' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../wasm_bindgen/convert/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::FromWasmAbi">FromWasmAbi</a> + 'static&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-Deref' class='anchor'></a><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#601-614' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Target' class="type"><code id='Target.t'>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = T</code></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id='method.deref' class="method hidden"><code id='deref.v'>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#603-613' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../wasm_bindgen/struct.JsStatic.html" title="struct wasm_bindgen::JsStatic">JsStatic</a>&lt;T&gt;</code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-569' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#566-568' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#554-561' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#558-560' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#602-611' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#608-610' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588-597' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#594-596' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,93 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `JsCast` trait in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, JsCast"><title>wasm_bindgen::JsCast - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait JsCast</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.instanceof">instanceof</a><a href="#tymethod.unchecked_from_js">unchecked_from_js</a><a href="#tymethod.unchecked_from_js_ref">unchecked_from_js_ref</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.dyn_into">dyn_into</a><a href="#method.dyn_ref">dyn_ref</a><a href="#method.has_type">has_type</a><a href="#method.is_instance_of">is_instance_of</a><a href="#method.is_type_of">is_type_of</a><a href="#method.unchecked_into">unchecked_into</a><a href="#method.unchecked_ref">unchecked_ref</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'JsCast', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/cast.rs.html#15-156' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>wasm_bindgen</a>::<wbr><a class="trait" href=''>JsCast</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait JsCast <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>&gt;,&nbsp;</span>{
fn <a href='#tymethod.instanceof' class='fnname'>instanceof</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
<div class='item-spacer'></div> fn <a href='#tymethod.unchecked_from_js' class='fnname'>unchecked_from_js</a>(val: <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.unchecked_from_js_ref' class='fnname'>unchecked_from_js_ref</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self;
fn <a href='#method.has_type' class='fnname'>has_type</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.dyn_into' class='fnname'>dyn_into</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.dyn_ref' class='fnname'>dyn_ref</a>&lt;T&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.unchecked_into' class='fnname'>unchecked_into</a>&lt;T&gt;(self) -&gt; T<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.unchecked_ref' class='fnname'>unchecked_ref</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.is_instance_of' class='fnname'>is_instance_of</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a></span>,
{ ... }
<div class='item-spacer'></div> fn <a href='#method.is_type_of' class='fnname'>is_type_of</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
}</pre></div><div class='docblock'><p>A trait for checked and unchecked casting between JS types.</p>
<p>Specified <a href="https://github.com/rustwasm/rfcs/pull/2">in an RFC</a> this trait is intended to provide support for
casting JS values between differnet types of one another. In JS there aren't
many static types but we've ascribed JS values with static types in Rust,
yet they often need to be switched to other types temporarily! This trait
provides both checked and unchecked casting into various kinds of values.</p>
<p>This trait is automatically implemented for any type imported in a
<code>#[wasm_bindgen]</code> <code>extern</code> block.</p>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.instanceof' class='method'><code id='instanceof.v'>fn <a href='#tymethod.instanceof' class='fnname'>instanceof</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></h3><div class='docblock'><p>Performs a dynamic <code>instanceof</code> check to see whether the <code>JsValue</code>
provided is an instance of this type.</p>
<p>This is intended to be an internal implementation detail, you likely
won't need to call this. It's generally called through the
<code>is_instance_of</code> method instead.</p>
</div><h3 id='tymethod.unchecked_from_js' class='method'><code id='unchecked_from_js.v'>fn <a href='#tymethod.unchecked_from_js' class='fnname'>unchecked_from_js</a>(val: <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; Self</code></h3><div class='docblock'><p>Performs a zero-cost unchecked conversion from a <code>JsValue</code> into an
instance of <code>Self</code></p>
<p>This is intended to be an internal implementation detail, you likely
won't need to call this.</p>
</div><h3 id='tymethod.unchecked_from_js_ref' class='method'><code id='unchecked_from_js_ref.v'>fn <a href='#tymethod.unchecked_from_js_ref' class='fnname'>unchecked_from_js_ref</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self</code></h3><div class='docblock'><p>Performs a zero-cost unchecked conversion from a <code>&amp;JsValue</code> into an
instance of <code>&amp;Self</code>.</p>
<p>Note the safety of this method, which basically means that <code>Self</code> must
be a newtype wrapper around <code>JsValue</code>.</p>
<p>This is intended to be an internal implementation detail, you likely
won't need to call this.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.has_type' class='method'><code id='has_type.v'>fn <a href='#method.has_type' class='fnname'>has_type</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Test whether this JS value has a type <code>T</code>.</p>
<p>This method will dynamically check to see if this JS object can be
casted to the JS object of type <code>T</code>. Usually this uses the <code>instanceof</code>
operator. This also works with primitive types like
booleans/strings/numbers as well as cross-realm object like <code>Array</code>
which can originate from other iframes.</p>
<p>In general this is intended to be a more robust version of
<code>is_instance_of</code>, but if you want strictly the <code>instanceof</code> operator
it's recommended to use that instead.</p>
</div><h3 id='method.dyn_into' class='method'><code id='dyn_into.v'>fn <a href='#method.dyn_into' class='fnname'>dyn_into</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Performs a dynamic cast (checked at runtime) of this value into the
target type <code>T</code>.</p>
<p>This method will return <code>Err(self)</code> if <code>self.has_type::&lt;T&gt;()</code>
returns <code>false</code>, and otherwise it will return <code>Ok(T)</code> manufactured with
an unchecked cast (verified correct via the <code>has_type</code> operation).</p>
</div><h3 id='method.dyn_ref' class='method'><code id='dyn_ref.v'>fn <a href='#method.dyn_ref' class='fnname'>dyn_ref</a>&lt;T&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Performs a dynamic cast (checked at runtime) of this value into the
target type <code>T</code>.</p>
<p>This method will return <code>None</code> if <code>self.has_type::&lt;T&gt;()</code>
returns <code>false</code>, and otherwise it will return <code>Some(&amp;T)</code> manufactured
with an unchecked cast (verified correct via the <code>has_type</code> operation).</p>
</div><h3 id='method.unchecked_into' class='method'><code id='unchecked_into.v'>fn <a href='#method.unchecked_into' class='fnname'>unchecked_into</a>&lt;T&gt;(self) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Performs a zero-cost unchecked cast into the specified type.</p>
<p>This method will convert the <code>self</code> value to the type <code>T</code>, where both
<code>self</code> and <code>T</code> are simple wrappers around <code>JsValue</code>. This method <strong>does
not check whether <code>self</code> is an instance of <code>T</code></strong>. If used incorrectly
then this method may cause runtime exceptions in both Rust and JS, this
should be used with caution.</p>
</div><h3 id='method.unchecked_ref' class='method'><code id='unchecked_ref.v'>fn <a href='#method.unchecked_ref' class='fnname'>unchecked_ref</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Performs a zero-cost unchecked cast into a reference to the specified
type.</p>
<p>This method will convert the <code>self</code> value to the type <code>T</code>, where both
<code>self</code> and <code>T</code> are simple wrappers around <code>JsValue</code>. This method <strong>does
not check whether <code>self</code> is an instance of <code>T</code></strong>. If used incorrectly
then this method may cause runtime exceptions in both Rust and JS, this
should be used with caution.</p>
<p>This method, unlike <code>unchecked_into</code>, does not consume ownership of
<code>self</code> and instead works over a shared reference.</p>
</div><h3 id='method.is_instance_of' class='method'><code id='is_instance_of.v'>fn <a href='#method.is_instance_of' class='fnname'>is_instance_of</a>&lt;T&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../wasm_bindgen/trait.JsCast.html" title="trait wasm_bindgen::JsCast">JsCast</a>,&nbsp;</span></code></h3><div class='docblock'><p>Test whether this JS value is an instance of the type <code>T</code>.</p>
<p>This method performs a dynamic check (at runtime) using the JS
<code>instanceof</code> operator. This method returns <code>self instanceof T</code>.</p>
<p>Note that <code>instanceof</code> does not always work with primitive values or
across different realms (e.g. iframes). If you're not sure whether you
specifically need only <code>instanceof</code> it's recommended to use <code>has_type</code>
instead.</p>
</div><h3 id='method.is_type_of' class='method'><code id='is_type_of.v'>fn <a href='#method.is_type_of' class='fnname'>is_type_of</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></h3><div class='docblock'><p>Performs a dynamic check to see whether the <code>JsValue</code> provided
is a value of this type.</p>
<p>Unlike <code>instanceof</code>, this can be specialised to use a custom check by
adding a <code>#[wasm_bindgen(is_type_of = callback)]</code> attribute to the
type import declaration.</p>
<p>Other than that, this is intended to be an internal implementation
detail of <code>has_type</code> and you likely won't need to call this.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-JsCast' class='impl'><code class='in-band'>impl JsCast for <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a href='#impl-JsCast' class='anchor'></a><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#444-458' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.instanceof' class="method hidden"><code id='instanceof.v-1'>fn <a href='#method.instanceof' class='fnname'>instanceof</a>(_val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#447-449' title='goto source code'>[src]</a></h4><h4 id='method.unchecked_from_js' class="method hidden"><code id='unchecked_from_js.v-1'>fn <a href='#method.unchecked_from_js' class='fnname'>unchecked_from_js</a>(val: <a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; Self</code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#451-453' title='goto source code'>[src]</a></h4><h4 id='method.unchecked_from_js_ref' class="method hidden"><code id='unchecked_from_js_ref.v-1'>fn <a href='#method.unchecked_from_js_ref' class='fnname'>unchecked_from_js_ref</a>(val: &amp;<a class="struct" href="../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self</code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#455-457' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../implementors/wasm_bindgen/trait.JsCast.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `UnwrapThrowExt` trait in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, UnwrapThrowExt"><title>wasm_bindgen::UnwrapThrowExt - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../wasm_bindgen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait UnwrapThrowExt</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.expect_throw">expect_throw</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.unwrap_throw">unwrap_throw</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-UnwrapThrowExt%3CT%3E-for-Option%3CT%3E">Option&lt;T&gt;</a><a href="#impl-UnwrapThrowExt%3CT%3E-for-Result%3CT%2C%20E%3E">Result&lt;T, E&gt;</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>wasm_bindgen</a></p><script>window.sidebarCurrent = {name: 'UnwrapThrowExt', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#744-755' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>wasm_bindgen</a>::<wbr><a class="trait" href=''>UnwrapThrowExt</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait UnwrapThrowExt&lt;T&gt;: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
fn <a href='#tymethod.expect_throw' class='fnname'>expect_throw</a>(self, message: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; T;
fn <a href='#method.unwrap_throw' class='fnname'>unwrap_throw</a>(self) -&gt; T { ... }
}</pre></div><div class='docblock'><p>An extension trait for <code>Option&lt;T&gt;</code> and <code>Result&lt;T, E&gt;</code> for unwraping the <code>T</code>
value, or throwing a JS error if it is not available.</p>
<p>These methods should have a smaller code size footprint than the normal
<code>Option::unwrap</code> and <code>Option::expect</code> methods, but they are specific to
working with wasm and JS.</p>
<p>On non-wasm32 targets, defaults to the normal unwrap/expect calls.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">wasm_bindgen</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="comment">// If the value is `Option::Some` or `Result::Ok`, then we just get the</span>
<span class="comment">// contained `T` value.</span>
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="number">42</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">unwrap_throw</span>(), <span class="number">42</span>);
<span class="kw">let</span> <span class="ident">y</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="prelude-val">None</span>;
<span class="comment">// This call would throw an error to JS!</span>
<span class="comment">//</span>
<span class="comment">// y.unwrap_throw()</span>
<span class="comment">//</span>
<span class="comment">// And this call would throw an error to JS with a custom error message!</span>
<span class="comment">//</span>
<span class="comment">// y.expect_throw(&quot;woopsie daisy!&quot;)</span></pre></div>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.expect_throw' class='method'><code id='expect_throw.v'>fn <a href='#tymethod.expect_throw' class='fnname'>expect_throw</a>(self, message: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; T</code></h3><div class='docblock'><p>Unwrap this container's <code>T</code> value, or throw an error to JS with the
given message if the <code>T</code> value is unavailable (e.g. an <code>Option&lt;T&gt;</code> is
<code>None</code>).</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.unwrap_throw' class='method'><code id='unwrap_throw.v'>fn <a href='#method.unwrap_throw' class='fnname'>unwrap_throw</a>(self) -&gt; T</code></h3><div class='docblock'><p>Unwrap this <code>Option</code> or <code>Result</code>, but instead of panicking on failure,
throw an exception to JavaScript.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-UnwrapThrowExt%3CT%3E-for-Option%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="../wasm_bindgen/trait.UnwrapThrowExt.html" title="trait wasm_bindgen::UnwrapThrowExt">UnwrapThrowExt</a>&lt;T&gt; for <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;</code><a href='#impl-UnwrapThrowExt%3CT%3E-for-Option%3CT%3E' class='anchor'></a><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#757-768' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.expect_throw' class="method hidden"><code id='expect_throw.v-1'>fn <a href='#method.expect_throw' class='fnname'>expect_throw</a>(self, message: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; T</code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#758-767' title='goto source code'>[src]</a></h4></div><h3 id='impl-UnwrapThrowExt%3CT%3E-for-Result%3CT%2C%20E%3E' class='impl'><code class='in-band'>impl&lt;T, E&gt; <a class="trait" href="../wasm_bindgen/trait.UnwrapThrowExt.html" title="trait wasm_bindgen::UnwrapThrowExt">UnwrapThrowExt</a>&lt;T&gt; for <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,&nbsp;</span></code><a href='#impl-UnwrapThrowExt%3CT%3E-for-Result%3CT%2C%20E%3E' class='anchor'></a><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#770-784' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.expect_throw-1' class="method hidden"><code id='expect_throw.v-2'>fn <a href='#method.expect_throw' class='fnname'>expect_throw</a>(self, message: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; T</code><a class='srclink' href='../src/wasm_bindgen/lib.rs.html#774-783' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../implementors/wasm_bindgen/trait.UnwrapThrowExt.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "wasm_bindgen";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>