From f34f42ab4ce2d76caf873565740da856e1ef8624 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 9 May 2023 21:12:22 +0100 Subject: [PATCH] Implement debug --- agb-hashmap/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/agb-hashmap/src/lib.rs b/agb-hashmap/src/lib.rs index 73c5bf31..2cbb2003 100644 --- a/agb-hashmap/src/lib.rs +++ b/agb-hashmap/src/lib.rs @@ -21,6 +21,7 @@ use alloc::alloc::Global; use core::{ alloc::Allocator, borrow::Borrow, + fmt::Debug, hash::{BuildHasher, BuildHasherDefault, Hash, Hasher}, iter::FromIterator, ops::Index, @@ -809,6 +810,16 @@ where { } +impl Debug for HashMap +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 { capacity * 85 / 100 }