This commit is contained in:
Joel Wejdenstål 2022-08-30 20:09:31 +02:00
parent 342011296c
commit f27dba3062
No known key found for this signature in database
GPG Key ID: DF03CEFBB1A915AA
1 changed files with 4 additions and 1 deletions

View File

@ -821,7 +821,10 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
// TODO: return std::collections::TryReserveError once std::collections::TryReserveErrorKind stabilises.
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
for shard in self.shards.iter() {
shard.write().try_reserve(additional).map_err(|_| TryReserveError {})?;
shard
.write()
.try_reserve(additional)
.map_err(|_| TryReserveError {})?;
}
Ok(())
}