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. 下划线hover下动态出现技巧

    酷炫的动画效果往往更能吸引眼球,下面我将分享纯CSS中,hover的时候出现下划线动态飞入的技巧. 1.下划线从左侧飞入: div::before{ content:""; wid ...

  2. 牛客OI赛制测试赛2 A 无序组数

    链接:https://www.nowcoder.com/acm/contest/185/A来源:牛客网 题目描述 给出一个二元组(A,B) 求出无序二元组(a,b) 使得(a|A,b|B)的组数 无序 ...

  3. Openjudge-2815-城堡问题

    对于这道题目来说的话,我们的思路是这样的,我们首先把数据读进来,然后把color数组清零. 我们的思路是这样的的,给每一个房间设置一个对应的color数组,然后color数组里面填满不同的数字,每一种 ...

  4. Images for Journals

    Images for publication Table of Contents 1. Images for publication 1.1. image format : vector image ...

  5. Centos6.5安装Nexus及安装时的一些错误

    注意:此篇博文未有配置部分,有需求的同学只能自行寻找了-- 1.下载: https://www.sonatype.com/download-oss-sonatype 2.官方推荐安装在/opt目录下 ...

  6. LeetCode(14)Longest Common Prefix

    题目 Write a function to find the longest common prefix string amongst an array of strings. 分析 该题目是求一个 ...

  7. 南宁2017ICPC总结

    ​    ​    ​     ​    ​ 南宁2017ICPC总结 第二次到南宁,高铁三个半小时好像没什么感觉了,广西的天气真的是又湿又冷,而且交通也及其不方面,所以对广西的印象也不是很好.这次承 ...

  8. int内部方法释义

    python基本数据类型包括:int.str.list.tuple.dict.bool.set(),一切事物都是对象,对象由类创建 1. bit_length:返回数字占用的二进制最小位数 def b ...

  9. MyISAM和InnoDB索引实现对比

    MyISAM索引实现 MyISAM引擎使用B+Tree作为索引结构,叶节点的data域存放的是数据记录的地址.如图:  这里设表一共有三列,假设我们以Col1为主键,则上图是一个MyISAM表的主索引 ...

  10. 如何安装python包

    安装python包有两种方法: 使用Python包管理器pip工具 在Linux系统中,首先 yum install python-pip 然后就可以欢快的pip install *** 啦 源代码安 ...