In this example, we explore embedding a WebAssembly component in an Elixir application.
We have an Elixir application in wasmex_example
which needs to generate a PDF.
This PDF will be generated by a WebAssembly module written in Rust.
The wasmex_certificate_rust
directory contains a Rust library for generating a certificate.
In there, you can run cargo component build
to compile the component and use it in the Elixir application (or the browser).
The wasmex_example
directory contains an Elixir application that uses this WebAssembly module.
To start the application, run mix generate_certificate && open certificate.pdf
.
It will run the built-in mix task, which in turn uses the Wasm component to generate the PDF and write it to the certificate.pdf
file.