Setting up a Cargo workspace
Since we are going to create a new application, it would be nice if we could make the code for the our_application
Rocket application work alongside this new application. Cargo has a feature called Cargo workspaces. A Cargo workspace is a set of different Cargo packages in a single directory.
Let's set up a Cargo workspace to have multiple applications in a single directory using the following steps:
- Create a directory, for example,
01Wasm
. - Move the
our_application
directory inside the01Wasm
directory and create a newCargo.toml
file inside the01Wasm
directory. - Edit the
Cargo.toml
file as follows:[workspace] members = [ "our_application", ]
- Create a new Rust application inside
01Wasm
using this command:cargo new our_application_wasm
- After that, add the new application as a member of the workspace in
01Wasm/Cargo.toml
, as follows:members = [ "our_application", "...