Rust snippt.
This repo record some rust source code when I learn rust follow Rust By Example Chinese Version.
-
Run by Cargo
- I suppose you have
Cargoinstalled cd RustPracticecargo run --example ${example}- eg:
cargo run --example hello, you can find all example inCargo.toml->[[example]]section
- I suppose you have
-
Run by Rust
-
I suppose you have
Rust compilerinstalled -
cd RustPractice/examples/ -
rustc ${example file} -
./${example} -
eg:
cd RustPractice/examples/ rustc format.rs ./format Dublin: 53.348°N 6.260°W Oslo: 59.950°N 10.750°E Vancouver: 49.250°N 123.100°W Color { red: 128, green: 255, blue: 90 } RGB (128, 255, 90) 0x80FF5A Color { red: 0, green: 3, blue: 254 } RGB (0, 3, 254) 0x0003FE Color { red: 0, green: 0, blue: 0 } RGB (0, 0, 0) 0x000000
-