一行搞定rust的运行环境

rust 运行环境的安装

安装

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh

helloworld

  • 方法一:rustc
// save file as helloworld.rs
fn main() {
    println!("hello helab")
    }
$ rustc helloworld.rs
$ ./helloworld
  • 方法二:cargo
$ cargo new rust_first_project --bin
$ cargo build
$ cargo run

Last modified on 2023-11-01