Implement debug

This commit is contained in:
Gwilym Inzani 2023-05-09 21:12:22 +01:00
parent e9f6120b4c
commit f34f42ab4c

View file

@ -21,6 +21,7 @@ use alloc::alloc::Global;
use core::{ use core::{
alloc::Allocator, alloc::Allocator,
borrow::Borrow, borrow::Borrow,
fmt::Debug,
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher}, hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
iter::FromIterator, iter::FromIterator,
ops::Index, ops::Index,
@ -809,6 +810,16 @@ where
{ {
} }
impl<K, V, ALLOCATOR: ClonableAllocator> Debug for HashMap<K, V, ALLOCATOR>
where
K: Debug,
V: Debug,
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_map().entries(self.iter()).finish()
}
}
const fn number_before_resize(capacity: usize) -> usize { const fn number_before_resize(capacity: usize) -> usize {
capacity * 85 / 100 capacity * 85 / 100
} }