Skip to content

Commit 61c2f0a

Browse files
authored
Add Payload::with_capacity (#262)
1 parent b87748e commit 61c2f0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/payload.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ impl Payload {
6363
Self(HashMap::new())
6464
}
6565

66+
/// Construct a new empty payload object with at least the specified capacity.
67+
pub fn with_capacity(capacity: usize) -> Self {
68+
Self(HashMap::with_capacity(capacity))
69+
}
70+
6671
/// Construct a payload object from the given hash map
6772
#[deprecated(since = "1.10.0", note = "use `Payload::from` instead")]
6873
pub fn new_from_hashmap(payload: HashMap<String, Value>) -> Self {

0 commit comments

Comments
 (0)