Cargo
cargo new
vs cargo init
- cargo new 是产生一个新目录
- cargo init 是在已有目录下初始化文件,比如 git clone 后
Rust programming
如何判断字符串是标点符号
rust
let term = "...";
if term.chars().all(|c| c.is_ascii_punctuation()) {
}
match 强大之处
diff
match (request.method(), request.url()) {
- (Method::Get, "/" | (Method::Get, "/index.html" | (Method::Get, "/index") => {
+ (Method::Get, "/" | "/index.html" | "/index") => {
serve_index()?
}