Skip to content

Commit eda613e

Browse files
authored
impl drop for Index (#10)
1 parent b22c05d commit eda613e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/hello_redisearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[macro_use]
22
extern crate redis_module;
33

4-
use redisearch_api::{self, init, Document, FieldType, Index};
54
use redis_module::{Context, NextArg, RedisError, RedisResult};
5+
use redisearch_api::{self, init, Document, FieldType, Index};
66

77
fn hello_redisearch(_: &Context, args: Vec<String>) -> RedisResult {
88
let mut args = args.into_iter().skip(1);

src/index.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ impl Index {
9797
}
9898
}
9999

100+
impl Drop for Index {
101+
fn drop(&mut self) {
102+
unsafe { raw::RediSearch_DropIndex(self.inner) }
103+
}
104+
}
105+
100106
pub struct ResultsIterator<'idx> {
101107
inner: *mut RSResultsIterator,
102108
index: &'idx Index,

0 commit comments

Comments
 (0)