Still trying to run this script here. And still a Rustacean learner.
Yesterday I had a problem with the docx_rs/docx-rs crate. Enlightenment from at54321.
But the script still doesn't run. It appears to have a problem with a crate called clap
.
D:\My documents\...\word_file>cargo run
Compiling word_file v0.1.0 (D:\My documents\software projects\EclipseWorkspace\py_exp\src\rust_2023-07A\word_file)
error[E0432]: unresolved import `clap::Parser`
--> src\main.rs:30:9
|
30 | use clap::Parser;
| ^^^^^^^^^^^^ no `Parser` in the root
error: cannot determine resolution for the derive macro `Parser`
--> src\main.rs:36:14
|
36 | #[derive(Parser, Debug)]
| ^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: cannot find attribute `command` in this scope
--> src\main.rs:37:7
|
37 | #[command(author, version, about, long_about = None)]
| ^^^^^^^
error: cannot find attribute `arg` in this scope
--> src\main.rs:39:11
|
39 | #[arg(short, long)]
| ^^^
error[E0599]: no function or associated item named `parse` found for struct `main::Args` in the current scope
--> src\main.rs:71:26
|
38 | struct Args {
| ----------- function or associated item `parse` not found for this struct
...
71 | let args = Args::parse();
| ^^^^^ function or associated item not found in `main::Args`
Very impressed with the clarity of Rust feedback. But I haven't managed to understand what's actually wrong here. As per the linked script my dependencies
section of Cargo.toml includes this line:
clap = "2.33.0"
... anyone know what's wrong this time?
Later
After changing to clap = "4.3.11"
. Still errors:
error: cannot find derive macro `Parser` in this scope
--> src\main.rs:36:14
|
36 | #[derive(Parser, Debug)]
| ^^^^^^
|
note: `Parser` is imported here, but it is only a trait, without a derive macro
--> src\main.rs:30:9
|
30 | use clap::Parser;
| ^^^^^^^^^^^^
... + 3 more errors no doubt due to the above
Unfortunately I haven't got to that part of Rust 101 where you learn about "derive macros"...! I have no idea what that means.