-
&'static strvalues stored asStringin headers (response.rs:10) —ct.to_string()and"gzip"are heap-allocated despite being static. Change the header map value type toCow<'static, str>so static values avoid allocation. -
as_bytes()builds an intermediateVec<u8>(response.rs:32) — every response allocates a full buffer before writing to the stream. Replace withwrite_to(&self, w: &mut impl Write)to write headers and body directly.
- MIME type values mis-grouped in
headersmodule (http.rs:12-13) —TEXT_PLAINandOCTET_STREAMare content-type values, not header names; they don't belong alongsideCONTENT_TYPEetc. - Non-deterministic header order (
response.rs:37) —HashMapiteration is randomized per-process, making response headers non-reproducible across runs.IndexMaporBTreeMapwould give stable ordering for easier debugging and testing.