# p.145に従ってプロジェクトを作成
cargo new samplecli
# 作成したディレクトリに移動
cd samplecli/
# p.148に従ってclap@=3.0.0-beta.2を依存関係に追加
cargo add clap@=3.0.0-beta.2
# p.152の「deriveマクロを使った記述方法」のコードをダウンロードして`src/main.rs`に上書き
curl https://raw.githubusercontent.com/forcia/rustbook/ba6ee3006dbe3efac0327058505f2bc288cbad4b/ch04/4-1/samplecli-derivemacro/src/main.rs > src/main.rs
# 実行
cargo run
Compiling samplecli v0.1.0 (C:\Users\hiroki\source\repos\samplecli)
error[E0433]: failed to resolve: could not find `Args` in `clap`
--> src\main.rs:3:10
|
3 | #[derive(Clap, Debug)]
| ^^^^ could not find `Args` in `clap`
|
= note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0407]: method `into_app_for_update` is not a member of trait `clap::IntoApp`
--> src\main.rs:3:10
|
3 | #[derive(Clap, Debug)]
| ^^^^ not a member of trait `clap::IntoApp`
|
= note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0407]: method `update_from_arg_matches` is not a member of trait `clap::FromArgMatches`
--> src\main.rs:3:10
|
3 | #[derive(Clap, Debug)]
| ^^^^ not a member of trait `clap::FromArgMatches`
|
= note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0404]: expected trait, found derive macro `clap::Args`
--> src\main.rs:3:10
|
3 | #[derive(Clap, Debug)]
| ^^^^ not a trait
|
= note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0404, E0407, E0433.
For more information about an error, try `rustc --explain E0404`.
error: could not compile `samplecli` due to 4 previous errors