Skip to content

upgrade bindgen to 0.5.4 and redismodule-rs to 0.9.2 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
upgrade bindgen to 0.5.4 and redismodule-rs to 0.9.2
  • Loading branch information
gkorland committed May 27, 2020
commit 3bd8d52c59266a98ddba908a61aaec09fb8c6d9f
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "redisearch_api"
version = "0.4.1"
version = "0.4.2"
authors = ["Gavrie Philipson <gavrie@redislabs.com>", "Guy Korland <guy.korland@redislabs.com>"]
edition = "2018"
description = "Rust RediSearch API binding"
Expand All @@ -14,15 +14,15 @@ crate-type = ["cdylib"]


[dependencies]
redis-module = { version="0.9.1", features = ["experimental-api"]}
redis-module = { version="0.9.2", features = ["experimental-api"]}
bitflags = "1.1"
libc = "0.2"
time = "0.1"
enum-primitive-derive = "0.1.2"
num-traits = "0.2.8"

[build-dependencies]
bindgen = "0.51"
bindgen = "0.54"
cmake = "0.1"

[features]
Expand Down
10 changes: 8 additions & 2 deletions src/document.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::convert::TryInto;
use std::ffi::CString;
use std::os::raw::c_void;
use std::ptr;
Expand All @@ -14,7 +15,12 @@ impl Document {
let lang = ptr::null(); // Default language

let doc = unsafe {
raw::RediSearch_CreateDocument(c_key.as_ptr() as *const c_void, key.len(), score, lang)
raw::RediSearch_CreateDocument(
c_key.as_ptr() as *const c_void,
key.len().try_into().unwrap(),
score,
lang,
)
};

Self { inner: doc }
Expand All @@ -28,7 +34,7 @@ impl Document {
self.inner,
name.as_ptr(),
c_value.as_ptr(),
value.len(),
value.len().try_into().unwrap(),
field_type.bits,
);
}
Expand Down
7 changes: 4 additions & 3 deletions src/index.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::convert::TryInto;
use std::ffi::c_void;
use std::ffi::{CStr, CString};
use std::ptr;
Expand Down Expand Up @@ -104,7 +105,7 @@ impl Index {
raw::RediSearch_DeleteDocument(
self.inner,
CString::new(key).unwrap().as_ptr() as *const c_void,
key.len(),
key.len().try_into().unwrap(),
)
};

Expand All @@ -123,7 +124,7 @@ impl Index {
raw::RediSearch_IterateQuery(
self.inner,
c_query.as_ptr(),
query_string.len(),
query_string.len().try_into().unwrap(),
&mut err_ptr,
)
};
Expand Down Expand Up @@ -172,7 +173,7 @@ impl Iterator for ResultsIterator<'_> {
// A null pointer means we have no results.
return None;
}
let mut len = 0usize;
let mut len = 0;
let key = unsafe {
let raw_key =
raw::RediSearch_ResultsIteratorNext(self.inner, self.index.inner, &mut len)
Expand Down