Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

HeaderMapExt should provide a `typed_{try_}get` alternative that handles missing headers

Aperta
#133 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Start with HeaderMapExt::typed_{try_}get and the Header::decode behavior described in the issue and linked discussion. Define the missing-header variants so they forward an empty iterator to the specific header implementation; done means each method returns Result<H, Error> and permits that implementation to provide a fallback or error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

See the discussion in https://github.com/tokio-rs/axum/issues/1781#issuecomment-1442496072 for the original issue & motivation.

TL;DR is that Header::decode allows each typed header to handle empty iterators in its own way and let the header implementation decide whether missing header is an error or whether to provide some default "parsed" value (e.g. empty collection), but HeaderMapExt::typed_{try_}get always return Option::None when header is not found in the HeaderMap, not giving such Header implementation a chance to correctly provide their own fallback.

It would be useful to have variation of those methods that always return Result<H, Error> by forwarding an empty iterator to the specific H::decode implementation and letting it decide whether to provide a Ok(fallback_value) or emit an error.

Lingua principale
Rust
Stelle
200
Fork
107
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hyperium/headers

Tutte le issue di hyperium/headers

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.