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

Can't iterate `http::header::ValueDrain` non-destructively

Aperta
#531 4 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

Direzione di ricerca

Inizia individuando l’implementazione e il comportamento dell’iteratore di http::header::ValueDrain, quindi esamina come sono rappresentati la rimozione da HeaderMap e l’accesso a HeaderValue. Il lavoro è completo quando un percorso di iterazione preso in prestito può esporre i valori rimossi come riferimenti, supportare iterazioni ripetute e preservare il comportamento esistente dell’iteratore proprietario senza richiedere una collection.

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

Descrizione

I need to remove an entry from a HeaderMap and then iterate the removed values non-destructively. The reason for this is I need to mutate the HeaderMap while I'm processing the removed values, but I need to process the removed values as &[u8] or &str. Doing anything else will involve reallocating for every value (I need to trim off the front) and that should be unnecessary for what I'm doing. If HeaderValue exposed its inner Bytes representation then I could use that (as that is cheaply cloneable), but it doesn't, and so I can't.

The simplest solution here would be if http::header::ValueDrain supported iterating references to its values. I know it's already an iterator, but it could have an .iter(&self) method that returns an iterator that borrows the drain (and then &'_ ValueDrain could also implement IntoIterator to return that same borrowed iterator). This way I can work with references to the values, or iterate the values multiple times, without having to collect them into a separate allocation (such as a Vec).

Lingua principale
Rust
Stelle
1.4k
Fork
382
Merge medio
10h 32m
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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/http

Tutte le issue di hyperium/http

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.