环境安装
- 去官网下载,手动安装
- 外网下载比较慢,可以使用 rsproxy 推荐使用这种方式
hello world
- 新建
main.rs - 输入如下代码
rs
fn main() {
println!("hello world");
}- 编译 & 运行
sh
# 编译
rustc ./main.rs
# 执行
./main # ./main.exe (on windows)注释
rs
fn main() {
// 输出一个 hello world 到控制台
println!("hello world")
/*
多行注释
多行注释
*/
}