bitcoinleveldb_table/
iterator_alt.rs

1crate::ix!();
2
3//-------------------------------------------[.cpp/bitcoin/src/leveldb/table/iterator.cc]
4
5impl Drop for LevelDBIteratorInner {
6    fn drop(&mut self) {
7        todo!();
8        /*
9            if (!cleanup_head_.IsEmpty()) {
10        cleanup_head_.Run();
11        for (CleanupNode* node = cleanup_head_.next; node != nullptr;) {
12          node->Run();
13          CleanupNode* next_node = node->next;
14          delete node;
15          node = next_node;
16        }
17      }
18        */
19    }
20}
21
22impl LevelDBIteratorInner {
23    
24    pub fn new() -> Self {
25    
26        todo!();
27        /*
28
29            cleanup_head_.function = nullptr;
30      cleanup_head_.next = nullptr;
31        */
32    }
33    
34    /**
35      | Clients are allowed to register
36      | function/arg1/arg2 triples that will be
37      | invoked when this iterator is destroyed.
38      |
39      | Note that unlike all of the preceding
40      | methods, this method is not abstract and
41      | therefore clients should not override it.
42      */
43    pub fn register_cleanup(&mut self, 
44        func: LevelDBIteratorCleanupFunction,
45        arg1: *mut c_void,
46        arg2: *mut c_void)  {
47        
48        todo!();
49        /*
50            assert(func != nullptr);
51      CleanupNode* node;
52      if (cleanup_head_.IsEmpty()) {
53        node = &cleanup_head_;
54      } else {
55        node = new CleanupNode();
56        node->next = cleanup_head_.next;
57        cleanup_head_.next = node;
58      }
59      node->function = func;
60      node->arg1 = arg1;
61      node->arg2 = arg2;
62        */
63    }
64}
65
66///------------------------
67pub struct EmptyIterator {
68    base:   LevelDBIterator,
69    status: Status,
70}
71
72impl EmptyIterator {
73    
74    pub fn new(s: &Status) -> Self {
75    
76        todo!();
77        /*
78        : status(s),
79
80        
81        */
82    }
83    
84    pub fn valid(&self) -> bool {
85        
86        todo!();
87        /*
88            return false;
89        */
90    }
91    
92    pub fn seek(&mut self, target: &Slice)  {
93        
94        todo!();
95        /*
96        
97        */
98    }
99    
100    pub fn seek_to_first(&mut self)  {
101        
102        todo!();
103        /*
104        
105        */
106    }
107    
108    pub fn seek_to_last(&mut self)  {
109        
110        todo!();
111        /*
112        
113        */
114    }
115    
116    pub fn next(&mut self)  {
117        
118        todo!();
119        /*
120            assert(false);
121        */
122    }
123    
124    pub fn prev(&mut self)  {
125        
126        todo!();
127        /*
128            assert(false);
129        */
130    }
131    
132    pub fn key(&self) -> Slice {
133        
134        todo!();
135        /*
136            assert(false);
137        return Slice();
138        */
139    }
140    
141    pub fn value(&self) -> Slice {
142        
143        todo!();
144        /*
145            assert(false);
146        return Slice();
147        */
148    }
149    
150    pub fn status(&self) -> crate::Status {
151        
152        todo!();
153        /*
154            return status_;
155        */
156    }
157}
158
159pub fn new_empty_iterator() -> *mut LevelDBIterator {
160    
161    todo!();
162        /*
163            return new EmptyIterator(Status::OK());
164        */
165}
166
167pub fn new_error_iterator(status: &Status) -> *mut LevelDBIterator {
168    
169    todo!();
170        /*
171            return new EmptyIterator(status);
172        */
173}