rust入门
安装
Linux
curl https://sh.rustup.rs -sSf | sh
如果安装成功
Rust is installed now. Great!
检查环境变量
source $HOME/.cargo/env
windows
配置
#要检查是否正确安装了 Rust
rustc --version
#更新
rustup update
#使用时出现 error: no default toolchain configured
#安装工具链。
rustup toolchain install 1.27.1
如果要卸载 rust
rustup self uninstall
编译
rustc [file]
引进包
文件名: Cargo.toml
[dependencies]
rand = "0.5.5"
使用包
创建一个项目
cargo new [project]
不运行任何代码构建项目
cargo build