From 2e4eca9ce12204abb22271806475e531ba27e4cd Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Tue, 10 Feb 2026 10:36:30 +0100 Subject: [PATCH] Add Payload::with_capacity --- src/payload.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/payload.rs b/src/payload.rs index 4c71c98..75bdb08 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -63,6 +63,11 @@ impl Payload { Self(HashMap::new()) } + /// Construct a new empty payload object with at least the specified capacity. + pub fn with_capacity(capacity: usize) -> Self { + Self(HashMap::with_capacity(capacity)) + } + /// Construct a payload object from the given hash map #[deprecated(since = "1.10.0", note = "use `Payload::from` instead")] pub fn new_from_hashmap(payload: HashMap) -> Self {