Skip to content

Hello Rust!

Published: at 22:54

最近一直在被安利Rust,诸如

所以手痒“入坑”Rust,感受一下Rust的魅力~

安装

前往官网下载Rust安装

在VSCode中开发

Rust在VSCode中的拓展名为rust-analyzer,安装后可以获得代码提示和相关功能

创建项目

在终端中输入cargo new hello_world即可创建项目目录,main.rs文件在src

编译

在终端中输入cargo build即可编译Rust项目,打包出来的文件在target文件夹中

运行

在终端中输入cargo run即可运行编译后的文件,或者在终端中运行.\target\debug\hello_world.exe文件也能得到同样的结果