1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::io::{Error, Result};
use super::iterator::BoxedIterator;
pub struct Iterator {
err: Option<std::io::Error>,
}
impl Iterator {
pub fn new(err: Option<std::io::Error>) -> BoxedIterator {
Box::new(Iterator { err })
}
}
#[tonic::async_trait]
impl crate::subnet::rpc::database::iterator::Iterator for Iterator {
async fn next(&mut self) -> Result<bool> {
Ok(false)
}
async fn error(&mut self) -> Result<()> {
if let Some(err) = &self.err {
return Err(Error::new(err.kind(), err.to_string()));
}
Ok(())
}
async fn key(&self) -> Result<&[u8]> {
Ok(&[])
}
async fn value(&self) -> Result<&[u8]> {
Ok(&[])
}
async fn release(&mut self) {}
}