Rust 程序设计语言简体中文版-- needle haystack Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 1.57s Running `target/debug/minigrep needle haystack` [src/main [src/main.rs: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 码力 | 600 页 | 12.99 MB | 1 年前3
Rust 程序设计语言 简体中文版 1.85.0needle 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 | 28 天前3
The Rust Programming Language,2nd Editionarguments: $ cargo run ["target/debug/greprs"] $ cargo run needle haystack ...snip... ["target/debug/greprs", "needle", "haystack"] You may notice that the first value in the vector is “target/debug/greprs”0 码力 | 617 页 | 1.54 MB | 1 年前3
共 3 条
- 1













