QuickStarted
https://rustwiki.org/zh-CN/book/
cargo
| cargo new #新建项目
cargo run #编译
|
依赖
https://crates.io/
| [dependencies]
ferris-says = "0.2"
|
使用:
| use ferris_says::say; // from the previous step
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let message = String::from("Hello fellow Rustaceans!");
let width = message.chars().count();
let mut writer = BufWriter::new(stdout.lock());
say(message.as_bytes(), width, &mut writer).unwrap();
}
|