Mercurial > lbo > hg > leveldb-rs
changeset 544:aeebdeb1c5ec
Merge pull request #10 from shangsony/patch-1
Update skipmap.rs
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 02 Sep 2021 18:48:00 +0200 |
parents | 98819897a01e (current diff) 18b686c68c1f (diff) |
children | b86bd64941c0 |
files | |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/skipmap.rs Tue Jul 27 09:57:23 2021 +0200 +++ b/src/skipmap.rs Thu Sep 02 18:48:00 2021 +0200 @@ -20,6 +20,26 @@ value: Vec<u8>, } +impl Drop for Node { + fn drop(&mut self) { + // large object should drop + if let Some(mut next) = self.next.take() { + while let Some(child) = next.next.take() { + next = child; + } + } + unsafe { + for skip in self.skips.iter_mut() { + if let Some(mut next) = skip.take() { + while let Some(child) = (*next).next.take() { + next = Box::into_raw(child); + } + } + } + } + } +} + /// Implements the backing store for a `MemTable`. The important methods are `insert()` and /// `contains()`; in order to get full key and value for an entry, use a `SkipMapIter` instance, /// `seek()` to the key to look up (this is as fast as any lookup in a skip map), and then call