Skip to content

Commit

Permalink
deploy: 41dd2c2
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Jan 29, 2024
1 parent cf09fb1 commit 850640d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ <h3 class="title-text">
<a class="subtext" href="https://trunkrs.dev/#javascript-interoperability"><small>- JavaScript interoperability</small></a>
</div>

<div class="toc-item-child">
<a class="subtext" href="https://trunkrs.dev/#library-crate"><small>- Library crate</small></a>
</div>



<div class="toc-item">
Expand Down Expand Up @@ -233,7 +237,18 @@ <h2 id="javascript-interoperability">JavaScript interoperability</h2>
include all JavaScript snippets generated by <code>wasm-bindgen</code> for interfacing with JavaScript functionality.</p>
<p>By default, functions exported from Rust, using <code>wasm-bingen</code>, can be accessed in the JavaScript code through the global
variable <code>window.wasmBindings</code>. This behavior can be disabled, and the name can be customized. </p>
<h1 id="next-steps">Next Steps</h1>
<h2 id="library-crate">Library crate</h2>
<p>Aside from having a <code>main</code> function, it is also possible to up your project as a <code>cdylib</code> project. In order to do that,
add the following to your <code>Cargo.toml</code>:</p>
<pre style="background-color:#ffffff;">
<code><span style="color:#323232;">[lib]
</span><span style="color:#63a35c;">crate-type </span><span style="color:#323232;">= [</span><span style="color:#183691;">&quot;cdylib&quot;</span><span style="color:#323232;">, </span><span style="color:#183691;">&quot;rlib&quot;</span><span style="color:#323232;">]
</span></code></pre>
<p>And then, define the entrypoint in your <code>lib.rs</code> like (does not need to be <code>async</code>):</p>
<pre style="background-color:#ffffff;">
<code><span style="color:#323232;">#[wasm_bindgen(start)]
</span><span style="font-weight:bold;color:#a71d5d;">pub</span><span style="color:#323232;"> async </span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">run</span><span style="color:#323232;">() {}
</span></code></pre><h1 id="next-steps">Next Steps</h1>
<p>That's not all! Trunk has even more useful features. Head on over to the following sections to learn more about how to use Trunk effectively.</p>
<ul>
<li><a href="https://trunkrs.dev/assets/">Assets</a>: learn about all of Trunk's supported asset types.</li>
Expand Down
2 changes: 1 addition & 1 deletion search_index.en.js

Large diffs are not rendered by default.

0 comments on commit 850640d

Please sign in to comment.