Files
wasm-bindgen/api/wasm_bindgen/convert/trait.FromWasmAbi.html

17 lines
65 KiB
HTML
Raw Normal View History

<!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 `FromWasmAbi` trait in crate `wasm_bindgen`."><meta name="keywords" content="rust, rustlang, rust-lang, FromWasmAbi"><title>wasm_bindgen::convert::FromWasmAbi - 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 FromWasmAbi</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.from_abi">from_abi</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-FromWasmAbi-for-*const%20T">*const T</a><a href="#impl-FromWasmAbi-for-*mut%20T">*mut T</a><a href="#impl-FromWasmAbi-for-Box%3C%5BJsValue%5D%3E">Box&lt;[JsValue]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bf32%5D%3E">Box&lt;[f32]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bf64%5D%3E">Box&lt;[f64]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bi16%5D%3E">Box&lt;[i16]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bi32%5D%3E">Box&lt;[i32]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bi64%5D%3E">Box&lt;[i64]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bi8%5D%3E">Box&lt;[i8]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bisize%5D%3E">Box&lt;[isize]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bu16%5D%3E">Box&lt;[u16]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bu32%5D%3E">Box&lt;[u32]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bu64%5D%3E">Box&lt;[u64]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Bu8%5D%3E">Box&lt;[u8]&gt;</a><a href="#impl-FromWasmAbi-for-Box%3C%5Busize%5D%3E">Box&lt;[usize]&gt;</a><a href="#impl-FromWasmAbi-for-Option%3CT%3E">Option&lt;T&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cf32%3E">Option&lt;f32&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cf64%3E">Option&lt;f64&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Ci32%3E">Option&lt;i32&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Ci64%3E">Option&lt;i64&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cisize%3E">Option&lt;isize&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cu32%3E">Option&lt;u32&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cu64%3E">Option&lt;u64&gt;</a><a href="#impl-FromWasmAbi-for-Option%3Cusize%3E">Option&lt;usize&gt;</a><a href="#impl-FromWasmAbi-for-String">String</a><a href="#impl-FromWasmAbi-for-Vec%3CT%3E">Vec&lt;T&gt;</a><a href="#impl-FromWasmAbi-for-bool">bool</a><a href="#impl-FromWasmAbi-for-char">char</a><a href="#impl-FromWasmAbi-for-f32">f32</a><a href="#impl-FromWasmAbi-for-f64">f64</a><a href="#impl-FromWasmAbi-for-i16">i16</a><a href="#impl-FromWasmAbi-for-i32">i32</a><a href="#impl-FromWasmAbi-for-i64">i64</a><a href="#impl-FromWasmAbi-for-i8">i8</a><a href="#impl-FromWasmAbi-for-isize">isize</a><a href="#impl-FromWasmAbi-for-u16">u16</a><a href="#impl-FromWasmAbi-for-u32">u32</a><a href="#impl-FromWasmAbi-for-u64">u64</a><a href="#impl-Fr
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>;
unsafe fn <a href='#tymethod.from_abi' class='fnname'>from_abi</a>(js: Self::<a class="type" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::FromWasmAbi::Abi">Abi</a>) -&gt; Self;
}</pre></div><div class='docblock'><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>
<p>This is the by-value variant of the opposite operation as <code>IntoWasmAbi</code>.</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>The wasm ABI type that this converts from when coming back out from the
ABI boundary.</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.from_abi' class='method'><code id='from_abi.v'>unsafe fn <a href='#tymethod.from_abi' class='fnname'>from_abi</a>(js: Self::<a class="type" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::FromWasmAbi::Abi">Abi</a>) -&gt; Self</code></h3><div class='docblock'><p>Recover a <code>Self</code> from <code>Self::Abi</code>.</p>
<h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1>
<p>This is only safe to call when -- and implementations may assume that --
the supplied <code>Self::Abi</code> was previously generated by a call to <code>&lt;Self as IntoWasmAbi&gt;::into_abi()</code> or the moral equivalent in JS.</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-FromWasmAbi-for-i32' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::FromWasmAbi">FromWasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code><a href='#impl-FromWasmAbi-for-i32' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#69-74' 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> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></h4><h4 id='method.from_abi' class="method hidden"><code id='from_abi.v-1'>unsafe fn <a href='#method.from_abi' class='fnname'>from_abi</a>(js: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self</code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#73' title='goto source code'>[src]</a></h4></div><h3 id='impl-FromWasmAbi-for-Option%3Ci32%3E' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::FromWasmAbi">FromWasmAbi</a> for <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.i32.html">i32</a>&gt;</code><a href='#impl-FromWasmAbi-for-Option%3Ci32%3E' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#94-105' 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' class="type">Abi</a> = <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalI32.html" title="struct wasm_bindgen::convert::WasmOptionalI32">WasmOptionalI32</a></code></h4><h4 id='method.from_abi-1' class="method hidden"><code id='from_abi.v-2'>unsafe fn <a href='#method.from_abi' class='fnname'>from_abi</a>(js: <a class="struct" href="../../wasm_bindgen/convert/struct.WasmOptionalI32.html" title="struct wasm_bindgen::convert::WasmOptionalI32">WasmOptionalI32</a>) -&gt; Self</code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#98-104' title='goto source code'>[src]</a></h4></div><h3 id='impl-FromWasmAbi-for-isize' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::FromWasmAbi">FromWasmAbi</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href='#impl-FromWasmAbi-for-isize' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#69-74' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi-3' class="type"><code id='Abi.t-3'>type <a href='#associatedtype.Abi' class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></h4><h4 id='method.from_abi-2' class="method hidden"><code id='from_abi.v-3'>unsafe fn <a href='#method.from_abi' class='fnname'>from_abi</a>(js: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self</code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#73' title='goto source code'>[src]</a></h4></div><h3 id='impl-FromWasmAbi-for-Option%3Cisize%3E' class='impl'><code class='in-band'>impl <a class="trait" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::FromWasmAbi">FromWasmAbi</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core:
<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-FromWasmAbi' class='impl'><code class='in-band'>impl FromWasmAbi for <a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a href='#impl-FromWasmAbi' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#319-326' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi-41' class="type"><code id='Abi.t-41'>type <a href='#associatedtype.Abi-41' class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></h4><h4 id='method.from_abi-40' class="method hidden"><code id='from_abi.v-41'>unsafe fn <a href='#method.from_abi-40' class='fnname'>from_abi</a>(js: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#323-325' title='goto source code'>[src]</a></h4></div><h3 id='impl-FromWasmAbi-1' 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>&gt; FromWasmAbi for <a class="struct" href="../../wasm_bindgen/struct.Clamped.html" title="struct wasm_bindgen::Clamped">Clamped</a>&lt;T&gt;</code><a href='#impl-FromWasmAbi-1' class='anchor'></a><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#381-388' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Abi-42' class="type"><code id='Abi.t-42'>type <a href='#associatedtype.Abi-42' class="type">Abi</a> = T::<a class="type" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::FromWasmAbi::Abi">Abi</a></code></h4><h4 id='method.from_abi-41' class="method hidden"><code id='from_abi.v-42'>unsafe fn <a href='#method.from_abi-41' class='fnname'>from_abi</a>(js: T::<a class="type" href="../../wasm_bindgen/convert/trait.FromWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::FromWasmAbi::Abi">Abi</a>) -&gt; Self</code><a class='srclink' href='../../src/wasm_bindgen/convert/impls.rs.html#385-387' 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.FromWasmAbi.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>