-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
36 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
//! hdf5 utilities for examples | ||
pub mod annhdf5; | ||
pub mod annhdf5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
//! defines a trait for filtering requests. | ||
//! See examples in tests/filtertest.rs | ||
//! See examples in tests/filtertest.rs | ||
use crate::prelude::DataId; | ||
|
||
/// Only queries returning true are taken into account along the search | ||
pub trait FilterT { | ||
fn hnsw_filter(&self, id:&DataId) -> bool; | ||
fn hnsw_filter(&self, id: &DataId) -> bool; | ||
} | ||
|
||
impl FilterT for Vec<usize> { | ||
fn hnsw_filter(&self, id:&DataId) -> bool { | ||
fn hnsw_filter(&self, id: &DataId) -> bool { | ||
return match &self.binary_search(id) { | ||
Ok(_) => true, | ||
_ => false } | ||
_ => false, | ||
}; | ||
} | ||
} | ||
|
||
impl<F> FilterT for F | ||
where F: Fn(&DataId) -> bool, | ||
where | ||
F: Fn(&DataId) -> bool, | ||
{ | ||
fn hnsw_filter(&self, id:&DataId) -> bool { | ||
return self(id) | ||
fn hnsw_filter(&self, id: &DataId) -> bool { | ||
return self(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters