hyperium / hyperium/http

Consider use of #[non_exhaustive]

Open
#382 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
378
Avg merge
1d 21h
Merged PRs (30d)
5

Description

I'm sure if this is work the effort but about a year ago I tried to add HTTP/3 to the Version enum and we hit the problem with exhaustive matching. That was independently fixed by adding a __NonExhaustive variant see https://github.com/hyperium/http/blob/master/src/version.rs#L52

In Rust 1.40 the #[non-exhaustive] attribute was landed https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#[non_exhaustive]-structs,-enums,-and-variants, so is there any benefit switching to that?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/version.rs around the Version enum and review the earlier HTTP/3 attempt in pull request #294. Compare the existing __NonExhaustive approach with Rust 1.40's #[non_exhaustive] behavior, including exhaustive matching implications. Done means establishing whether switching provides a benefit and documenting or implementing the agreed change.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.