Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Possible scheme fields improvement

Đang mở
#208 0 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend

Hướng nghiên cứu

Start with the README example using Scheme!, get_field, and set_field_value, then read the scheme and field APIs that define how field references are created and checked. Explore whether compile-time field information can provide a non-optional FieldRef while preventing values from unrelated schemes from being passed. Done means the API addresses both concerns; the issue names no tests, so identify relevant coverage while reading the implementation.

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

Mô tả

I noticed the readme example has a few unwraps that could probably be avoided. For example:


let scheme = Scheme! {
    http.method: Bytes,
    http.ua: Bytes,
    port: Int,
}
.build();

// ...

ctx.set_field_value(scheme.get_field("http.method").unwrap(), "GET")?;

I played around a bit to see if the field information could be returned when defining the scheme. That information could then be used to get a non-optional FieldRef based on the fact we know such fields were defined at compile time. I created a fork to demonstrate the idea: https://github.com/tombailey/wirefilter/pull/1

Just to note, that fork is AI slop. It is not intended as a real patch

And the fork doesn't prevent set_field_value being called with a field from an unrelated scheme

Ngôn ngữ chính
Rust
Star
1.2k
Fork
126
Merge trung bình
12 giờ 12 phút
Pull request đã merge (30 ngày)
4

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

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 cloudflare/wirefilter

Tất cả issue của cloudflare/wirefilter

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.