From a753ce40c0076cd8bcded2a1a305c8d680626d4c Mon Sep 17 00:00:00 2001 From: dlzht <78463157+dlzht@users.noreply.github.com> Date: Tue, 3 Dec 2024 21:51:21 +0800 Subject: [PATCH] fix: capacity handling in HeaderMap::try_with_capacity (#710) Closes #353 --- src/header/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/header/map.rs b/src/header/map.rs index 7610175b..07b4554a 100644 --- a/src/header/map.rs +++ b/src/header/map.rs @@ -521,7 +521,7 @@ impl HeaderMap { Ok(HeaderMap { mask: (raw_cap - 1) as Size, indices: vec![Pos::none(); raw_cap].into_boxed_slice(), - entries: Vec::with_capacity(raw_cap), + entries: Vec::with_capacity(usable_capacity(raw_cap)), extra_values: Vec::new(), danger: Danger::Green, })