The example usage on README.md is not working for me.

Đang mở
#79 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu bằng cách đọc ví dụ trong README.md và tái hiện ví dụ đó trong một dự án Cargo mới bằng cargo build. So sánh thiết lập dependency của ví dụ với các lỗi tracing_subscriber và clap được báo cáo liên quan đến feature, cùng với lỗi API rcgen. Công việc được xem là hoàn tất khi ví dụ được ghi trong tài liệu build thành công cho một dự án mới.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

after creating a new project, i used cargo add http-mitm-proxy then used cargo build but for some reason it giving me these errors:

error[E0432]: unresolved import `tracing_subscriber::EnvFilter`
   --> src/main.rs:7:5
    |
7   | use tracing_subscriber::EnvFilter;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `EnvFilter` in the root
    |
note: found an item that was configured out
   --> /home/zohaib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.19/src/lib.rs:234:21
    |
234 |     pub use filter::EnvFilter;
    |                     ^^^^^^^^^
note: the item is gated here
   --> /home/zohaib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.19/src/lib.rs:232:1
    |
232 | / feature! {
233 | |     #![all(feature = "env-filter", feature = "std")]
234 | |     pub use filter::EnvFilter;
235 | | }
    | |_^
    = note: this error originates in the macro `feature` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `tracing_subscriber::EnvFilter`
   --> src/main.rs:8:5
    |
8   | use tracing_subscriber::EnvFilter;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `EnvFilter` in the root
    |
note: found an item that was configured out
   --> /home/zohaib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.19/src/lib.rs:234:21
    |
234 |     pub use filter::EnvFilter;
    |                     ^^^^^^^^^
note: the item is gated here
   --> /home/zohaib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.19/src/lib.rs:232:1
    |
232 | / feature! {
233 | |     #![all(feature = "env-filter", feature = "std")]
234 | |     pub use filter::EnvFilter;
235 | | }
    | |_^
    = note: this error originates in the macro `feature` (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find derive macro `Parser` in this scope
  --> src/main.rs:10:10
   |
10 | #[derive(Parser)]
   |          ^^^^^^
   |
note: `Parser` is imported here, but it is only a trait, without a derive macro
  --> src/main.rs:3:18
   |
3  | use clap::{Args, Parser};
   |                  ^^^^^^

error: cannot find attribute `clap` in this scope
  --> src/main.rs:12:7
   |
12 |     #[clap(flatten)]
   |       ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find derive macro `Args` in this scope
  --> src/main.rs:16:10
   |
16 | #[derive(Args, Debug)]
   |          ^^^^
   |
note: `Args` is imported here, but it is only a trait, without a derive macro
  --> src/main.rs:3:12
   |
3  | use clap::{Args, Parser};
   |            ^^^^

error: cannot find attribute `arg` in this scope
  --> src/main.rs:18:7
   |
18 |     #[arg(required = false)]
   |       ^^^

error: cannot find attribute `arg` in this scope
  --> src/main.rs:20:7
   |
20 |     #[arg(required = false)]
   |       ^^^

error[E0599]: no function or associated item named `parse` found for struct `Opt` in the current scope
  --> src/main.rs:46:20
   |
11 | struct Opt {
   | ---------- function or associated item `parse` not found for this struct
...
46 |     let opt = Opt::parse();
   |                    ^^^^^ function or associated item not found in `Opt`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `parse`, perhaps you need to implement one of them:
           candidate #1: `Parser`
           candidate #2: `TypedValueParser`

error[E0599]: no method named `with_env_filter` found for struct `SubscriberBuilder` in the current scope
  --> src/main.rs:50:10
   |
49 | /     tracing_subscriber::fmt()
50 | |         .with_env_filter(EnvFilter::from_default_env())
   | |_________-^^^^^^^^^^^^^^^
   |
help: there is a method `with_file` with a similar name
   |
50 |         .with_file(EnvFilter::from_default_env())
   |          ~~~~~~~~~

error[E0599]: no function or associated item named `from_ca_cert_pem` found for struct `CertificateParams` in the current scope
   --> src/main.rs:55:47
    |
55  |         let param = rcgen::CertificateParams::from_ca_cert_pem(
    |                                               ^^^^^^^^^^^^^^^^ function or associated item not found in `CertificateParams`
    |
note: if you're trying to build a new `CertificateParams`, consider using `CertificateParams::new` which returns `Result<CertificateParams, rcgen::Error>`
   --> /home/zohaib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rcgen-0.13.2/src/certificate.rs:122:2
    |
122 |     pub fn new(subject_alt_names: impl Into<Vec<String>>) -> Result<Self, Error> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `http_proxy` (bin "http_proxy") due to 10 previous errors

Ngôn ngữ chính
Rust
Star
66
Fork
12
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của hatoo/http-mitm-proxy

Tất cả issue của hatoo/http-mitm-proxy

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.