Create a simple Debug implementation for Store

This commit is contained in:
Nick Fitzgerald
2020-06-01 14:40:45 -07:00
parent 2bb6a82794
commit 8adae5d1ad
2 changed files with 9 additions and 1 deletions

View File

@@ -74,9 +74,10 @@ impl ExternRef {
impl fmt::Debug for ExternRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let ExternRef { inner, store: _ } = self;
let store = self.store();
f.debug_struct("ExternRef")
.field("inner", &inner)
.field("store", &"..")
.field("store", &store)
.finish()
}
}

View File

@@ -983,6 +983,13 @@ impl Default for Store {
}
}
impl fmt::Debug for Store {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let inner = &*self.inner as *const StoreInner;
f.debug_struct("Store").field("inner", &inner).finish()
}
}
impl Drop for StoreInner {
fn drop(&mut self) {
for instance in self.instances.get_mut().iter() {