In order to setup a project we need to install the nightly build of Rust and add the WebAssembly target. For an improved workflow we also install the CLI tools wasm-pack and wasm-gc.

Install:

brew install rustup

Run:

rustup-init

Setup nightly toolchain as default.

rustup default nightly

Then we add the target wasm32-unknown-unknown

rustup target add wasm32-unknown-unknown

In addition, we use cargo, Rust's package manager, to install wasm-pack

cargo install wasm-pack

This tool seeks to be the one-stop shop for building and working with Rust-generated WebAssembly that you would like to interop with JavaScript in the browser or with Node.js.

For the first couple lessons, we don't use wasm-pack. Instead, we're going to use a tool called wasm-gc. We install it.

cargo instal wasm-gc

wasm-gc is a tool to remove all unneeded exports, imports, functions, and so on from a WebAssembly module.

Install HTTPS server:

cargo install https

[Rust] Setup Rust for WebAssembly的更多相关文章

  1. 【Rust】Rust的安装和配置

    -----------------------参考文档------------------------------------- https://www.rust-lang.org/tools/ins ...

  2. 【rust】Rust变量绑定(3)

    Rust 是一个静态类型语言,这意味着我们需要先确定我们需要的类型. 什么是变量绑定? 将一些值绑定到一个名字上,这样可以在之后使用他们. 如何声明一个绑定? 使用 let 关键字: fn main( ...

  3. 【rust】Rust 的构建系统和包管理工具Cargo认识并初步使用(2)

    Cargo 是 Rust 的构建系统和包管理工具,同时 Rustacean 们使用 Cargo 来管理它们的 Rust 项目.Cargo 负责三个工作:构建你的代码,下载你代码依赖的库并编译这些库.我 ...

  4. 【rust】rust安装,运行第一个Rust 程序 (1)

    安装 Rust 在 Unix 类系统如 Linux 和 macOS 上,打开终端并输入: curl https://sh.rustup.rs -sSf | sh 回车后安装过程出现如下显示: info ...

  5. CA周记 2022年的第一课 - Rust

    现代编程语言有很多,在我的编程学习里面有小学阶段的 LOGO , 中学阶段的 Pascal ,也有大学阶段的 C/C++.Java..NET,再到工作的 Objective-C .Swift.Go.K ...

  6. 使用 Rust 构建分布式 Key-Value Store

    欢迎大家前往腾讯云社区,获取更多腾讯海量技术实践干货哦~ 引子 构建一个分布式 Key-Value Store 并不是一件容易的事情,我们需要考虑很多的问题,首先就是我们的系统到底需要提供什么样的功能 ...

  7. Tokio,Rust异步编程实践之路

    缘起 在许多编程语言里,我们都非常乐于去研究在这个语言中所使用的异步网络编程的框架,比如说Python的 Gevent.asyncio,Nginx 和 OpenResty,Go 等,今年年初我开始接触 ...

  8. Cargo, Rust’s Package Manager

    http://doc.crates.io/ Installing The easiest way to get Cargo is to get the current stable release o ...

  9. Rust学习资源和路线

    Rust学习资源和路线 来源 https://rust-lang-cn.org/article/23 学习资源 The Rust Programming Language 堪称Rust的"T ...

随机推荐

  1. slides 在线ppt && React && Angular

    现在主流前端框架 有3个 Vue React Angular 如果有时间就都学习,理解一下他们的差异性~ 在线ppt的一个网站 这个是npm讲解的,不错 https://slides.com/seld ...

  2. Ubuntu下编辑并编译运行c++程序

    一.使用vim编辑c++代码: vim hello.cpp 输入如下代码: #include <iostream> using namespace std; int main() { co ...

  3. IntelliJ IDEA使用eclipse compiler(ecj)解决lombok编译问题

    1:为什么要使用在idea使用eclipse compiler(ecj)? 因为idea默认使用javac,而javac当在编译时发现一个编译错误就直接停止编译了.而ecj支持proceed on e ...

  4. C和C++中动态链接库的创建和链接(原创,装载请注明原处)

    C和C++中动态链接库的创建和链接 1.创建DLL(动态链接库)-C++方式 1.创建DLL(动态链接库-C++方式) 1.在VS(以VS2017为例)中创建DLL动态链接库. 解决方案名称为:MyD ...

  5. POJ-3278 抓住这头牛

    广搜解决. 广搜搜出最短路,直接输出返回就行了. 每个点只搜一次,而且界限进行一次判断. else 语句里面不要用if    else if,这样的话就直走一条路了. #include <ios ...

  6. MySQL存储过程实践

    对employees数据库建立存储过程 创建不含有输入输出变量的存储过程 DELIMITER // -- 设定语句结束分隔符 DROP PROCEDURE IF EXISTS GetEmployees ...

  7. 利用system-config-kickstart实现半自动化安装

    老司机开车了… 上车请坐稳… centos7系统 首先确认已经安装了system-config-kickstart包,如果没有安装就yum install system-config-kickstar ...

  8. Ducci Sequence解题报告

    A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, ... ,  ...

  9. ubunt设置终端快捷键设置 及 常用快捷键

    Ctrl+A:将光标移动到命令行的开始处. Ctrl+E:将光标移动到命行令的结尾处. Ctrl+U:删除行首到光标出的字符. Ctrl+Z:把当前进程送到后台处理.  &    bg 部分快 ...

  10. 自动化项目配置或用例文件格式推荐--yaml

    关于yaml YAML语言的设计目标,就是方便人类读写.如果你想要实现一些用ini不好做到的配置,可以使用yaml格式作为配置文件 大小写敏感 使用缩进表示层级关系 缩进时不允许使用Tab键,只允许使 ...