O'Reilly logo

Programming WebAssembly with Rust by Kevin Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating WebAssembly Robots

Now for the fun part: creating WebAssembly robots! We’ve built an engine that can load WebAssembly modules into memory, expose a runtime host for them, and safely allow them to interact with a virtual environment and manipulate shared state. Now it’s time to exercise that engine by building some robots.

First, let’s create a fairly dumb target. I wanted a “read hungry” robot to ensure that no matter how frequently a robot queried its own state, it couldn’t cause a threading dead lock in the system. Create a new library Rust module called dumbotrs and add it to the workspace. Its Cargo.toml should look like the following:

 [package]
 name = ​"dumbotrs"
 version = ​"0.1.0"
 authors = [​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required