Rust 程序设计语言 简体中文版 1.85.0
needle haystack Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.57s Running `target/debug/minigrep needle haystack` [src/main [src/main.rs:5:5] args = [ "target/debug/minigrep", "needle", "haystack", ] 注意 vector 的第一个值是 "target/debug/minigrep",它是我们二进制文件的名称。这与 C 中 的参数列表的行为相匹配,让程序使用在执行时调用它们的名称。如果要在消息中打印它或者 根据用于调用程序的命令行 match(needle: &str, haystack: &str) -> bool { haystack.contains(needle) } 会得到这个错误: error: expected identifier, found keyword `match` --> src/main.rs:4:4 | 4 | fn match(needle: &str, haystack: &str) -> bool0 码力 | 562 页 | 3.23 MB | 12 天前3
共 1 条
- 1