From 7b2e1b91a7deddcb4095139fc3f278b34b387cd0 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 27 Oct 2016 10:20:24 +0100 Subject: [PATCH] Implement Debug for DB --- src/rocksdb.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rocksdb.rs b/src/rocksdb.rs index 928b212..5b1a301 100644 --- a/src/rocksdb.rs +++ b/src/rocksdb.rs @@ -22,6 +22,7 @@ use std::ops::Deref; use std::path::Path; use std::slice; use std::str::from_utf8; +use std::fmt; use self::libc::size_t; @@ -784,6 +785,12 @@ impl Drop for DB { } } +impl fmt::Debug for DB { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "RocksDB {{ path: {:?} }}", self.path()) + } +} + impl Writable for WriteBatch { /// Insert a value into the database under the given key fn put(&self, key: &[u8], value: &[u8]) -> Result<(), String> {