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
use crate::{raw, GetPtr};
pub struct ScanCursor {
ptr: *mut raw::RedisModuleScanCursor,
}
impl ScanCursor {
pub fn new() -> Self {
ScanCursor {
ptr: unsafe { raw::RedisModule_ScanCursorCreate.unwrap()() },
}
}
pub fn restart(&mut self) {
unsafe { raw::RedisModule_ScanCursorRestart.unwrap()(self.ptr) }
}
}
impl GetPtr for ScanCursor {
type PtrType = raw::RedisModuleScanCursor;
fn get_ptr(&self) -> *mut Self::PtrType {
self.ptr
}
}
impl Drop for ScanCursor {
fn drop(&mut self) {
unsafe { raw::RedisModule_ScanCursorDestroy.unwrap()(self.ptr) }
}
}