From e6f82c17245ec2c1475079403a27aba28b7f1780 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Tue, 18 Oct 2022 14:14:24 +0300 Subject: [PATCH 1/2] improve PreTransformIndex --- src/index/pretransform.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index/pretransform.rs b/src/index/pretransform.rs index eaa6255..0d76be0 100644 --- a/src/index/pretransform.rs +++ b/src/index/pretransform.rs @@ -64,6 +64,17 @@ where }) } } + + pub fn prepend_transform(&mut self, ltrans: LT) -> Result<()>{ + unsafe { + faiss_try(faiss_IndexPreTransform_prepend_transform( + self.inner, + ltrans.inner_ptr(), + ))?; + + Ok(()) + } + } } impl IndexImpl { From d3fbfcb85ae23068e532bbbf0837c0d6acbbad99 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Wed, 19 Oct 2022 10:40:03 +0300 Subject: [PATCH 2/2] check formatting `cargo fmt` --- src/index/ivf_flat.rs | 2 +- src/index/pretransform.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index/ivf_flat.rs b/src/index/ivf_flat.rs index e710162..05e2993 100644 --- a/src/index/ivf_flat.rs +++ b/src/index/ivf_flat.rs @@ -5,7 +5,7 @@ use super::*; use crate::error::Result; use crate::faiss_try; use std::mem; -use std::os::raw::{c_int, c_char}; +use std::os::raw::{c_char, c_int}; use std::ptr; /// Alias for the native implementation of a flat index. diff --git a/src/index/pretransform.rs b/src/index/pretransform.rs index 0d76be0..5e706f9 100644 --- a/src/index/pretransform.rs +++ b/src/index/pretransform.rs @@ -65,13 +65,13 @@ where } } - pub fn prepend_transform(&mut self, ltrans: LT) -> Result<()>{ + pub fn prepend_transform(&mut self, ltrans: LT) -> Result<()> { unsafe { faiss_try(faiss_IndexPreTransform_prepend_transform( self.inner, ltrans.inner_ptr(), ))?; - + Ok(()) } }