Mercurial > lbo > hg > leveldb-rs
changeset 19:d3ee36ce3763
Add empty() method to SnapshotList
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 11 Jun 2016 13:21:15 +0200 |
parents | 379bcf419cec |
children | 9a6387f8c829 |
files | src/types.rs |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/types.rs Sat Jun 11 13:19:42 2016 +0200 +++ b/src/types.rs Sat Jun 11 13:21:15 2016 +0200 @@ -87,6 +87,11 @@ } self.map.remove(&ss); } + + pub fn empty(&self) -> bool { + self.oldest == 0 + } + } #[cfg(test)] @@ -97,10 +102,14 @@ fn test_snapshot_list() { let mut l = SnapshotList::new(); + assert!(l.empty()); + let oldest = l.new_snapshot(1); l.new_snapshot(2); let newest = l.new_snapshot(0); + assert!(!l.empty()); + assert_eq!(l.oldest(), 1); assert_eq!(l.newest(), 0);