Skip to content
/ dev-wasm-rust Public template

Simple devcontainer for Rust + WASM development

License

Notifications You must be signed in to change notification settings

dev-wasm/dev-wasm-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devcontainer WASM-Rust

Simple devcontainer for Rust development

Usage

Github Codespaces

Just click the button:

Open in GitHub Codespaces

Visual Studio Code

Note this assumes that you have the VS code support for remote containers and docker installed on your machine.

git clone https://github.com/dev-wasm/dev-wasm-rust
cd dev-wasm-rust
code ./

Visual studio should prompt you to see if you want to relaunch the workspace in a container, you do.

Building and Running

Getting Started

main.rs is a simple console application that prints a message, writes a file to disk and then copies that file to a different file

rustc -g --target wasm32-wasi main.rs
wasmtime main.wasm --dir .

Serving web requests

There is a simple example of web serving via WebAssembly + CGI (WAGI) in the webserver directory. It uses the lighttpd web server and mod_cgi. See the webserver/lighttpd.conf file for more details.

rustc -g --target wasm32-wasi webserver/wagi.rs
lighttpd -D -f webserver/lighttpd.conf

lighttpd is configured to serve on port 8080. If you run it in codespaces, it should pop up a dialog making it super easy to connect to your server. In VS Code it should be available on https://localhost:8080.

About

Simple devcontainer for Rust + WASM development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published