最近接触到了 Rust 变成语言, 风格与C语言类似,但是开发起来轻松多了。
创建项目, 一个命令搞定
$ cargo new hello_world Created binary (application) `hello_world` package
然后一条命令就可以编译运行,

$ cd hello_world;$ cargo run Compiling hello_world v0.1.0 (D:\projcts\hello_world) Finished dev [unoptimized + debuginfo] target(s) in 0.50s Running `target\debug\hello_world.exe`Hello, world!
有没有感觉很方便。
下面看看程序的结构,配置文件,及code
$ ls -lR.:total 1-rw-r--r-- 1 pp 197121 180 Nov 15 21:33 Cargo.tomldrwxr-xr-x 1 pp 197121 0 Nov 15 21:33 src/./src:total 1-rw-r--r-- 1 pp 197121 45 Nov 15 21:33 main.rs$ cat Cargo.toml[package]name = "hello_world"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[dependencies]$ cat src/main.rsfn main() { println!("Hello, world!");}