Add Option<&'static [u8]> method for header names
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia individuando la rappresentazione del nome dell’header e il relativo metodo as_bytes esistente, quindi esamina come vengono identificati i nomi degli header standard. Aggiungi il metodo proposto in modo che i nomi ASCII standard possano esporre byte statici, mentre gli altri nomi restituiscano None, e aggiungi test che coprano entrambi i casi. Nell’issue non sono menzionati file o percorsi di test specifici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
This enhancement focuses on improving the usability of the http crate when integrating Rust HTTP libraries with other VM engines, such as V8 (specifically for, but not limited to Deno). The goal is to provide embedding users with a specific method that allows extracting a static 7-bit string from a well-known ASCII header name. By treating header strings as interned strings in scripting engines [1] [2], we can effectively reduce garbage collection pressure, leading to enhanced performance and efficiency.
To achieve this, we propose introducing an Option<&'static [u8]> method for header names. This approach offers a more efficient means of passing header names across embedding boundaries. When working with static ASCII header names, this method allows direct access to the header name bytes across embedding boundaries, without the need for additional memory allocation or garbage collection overhead.
This may also be useful for Python embedders [2], as (I believe) the CPython engine allows creation of strings from const 1-byte buffers.
Alternatives
While we do have an as_bytes method on a header name, this does not tell us the provenance of those bytes, and whether the header is a StandardHeader. We cannot use these as "externally interned" strings in an embedding context because they may be allocated.
The hash function of the header could be used allow us to map between standard headers and interned strings in the embedded engine, but this requires an additional string comparison operation.
References
[1] V8's NewExternalOneByte method:
[2] Python's PyUnicode_FromKindAndData method (which I believe will avoid copies where necessary):
https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_FromKindAndData
- Lingua principale
- Rust
- Stelle
- 1.4k
- Fork
- 385
- Merge medio
- 2g 4h
- PR unite (30g)
- 1
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hyperium/http
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di hyperium/http
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
swc-project/swc#12516 ·
I maintainer di solito rispondono entro 1 giorno
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security updateForse già presa @muscariello l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
[work-item] adam-adae-worsening-emergence: conform spec.yaml to the specification style contract (REQ-1280)Forse già presa @muse-yamaa-bot l’ha presa oggi. Apertawork-item
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]:设置的关于页面,“系统信息”部分排版异常Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
metasequoiaime/msime#7328 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
eclipse-opensovd/classic-diagnostic-adapter#616 ·
I maintainer di solito rispondono entro 2 giorni