flush DB changes on drop (#2795)

This commit is contained in:
Robert Habermeier 2016-10-22 15:22:34 +02:00 committed by Gav Wood
parent 8e5c9ff162
commit 7bd37e3972

View File

@ -595,6 +595,13 @@ impl Database {
}
}
impl Drop for Database {
fn drop(&mut self) {
// write all buffered changes if we can.
let _ = self.flush();
}
}
#[cfg(test)]
mod tests {
use hash::*;