You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
~ cargo new hello &&cd$_~ cargo run
Compiling hello v0.1.0 (/Users/nonocast/Develop/hello/hello-rust/hello)
Finished dev [unoptimized + debuginfo] target(s) in 1.68s
Running `target/debug/hello`
Hello, world!
其中自动生成的Cargo.toml有点package.json的意思,
[package]
name = "hello"version = "0.1.0"authors = ["nonocast <nonocast@gmail.com>"]
edition = "2018"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
第一个Rust程序
hello.rs
语言特性
工具链
通过cargo建立hello world, cargo run会自动cargo build,你可以将两步分离:
其中自动生成的Cargo.toml有点package.json的意思,
变量和可变性
let mut x = 5
数据类型包括:
说明:
let a = [1, 2, 3, 4, 5]
函数
todo
参考资料:
The text was updated successfully, but these errors were encountered: