Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
Signed-off-by: Kosuke Morimoto <[email protected]>
  • Loading branch information
kmrmt committed Feb 14, 2024
1 parent 56c5878 commit 45d9d2c
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions rust/libs/algorithm/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,17 @@ pub mod algorithm2 {
fn save(p: &str) -> Result<&Self>;
}

pub trait Query {
type V;
fn get_query() -> Result<&Self::V>;
fn set_query(v: &V) -> Result<()>;
type P;
fn get_parameter() -> Result<&V>;
fn set_parameter(a: &Self::P) -> Result<()>;
// example like NGT
#[derive(Serialize, Deserialize, Debug)]
struct SearchQuery {
vector: Vec<f32>,
size: u64,
epsilon: f32,
radius: f32,
}

pub trait Param {
type A;
fn get_parameters() -> Result<&Self::A>;
fn set_parameters(a: &Self::A) -> Result<()>;
}

pub trait Response {
type Status;
type Result;
fn get_status() -> Status;
fn get_result() -> Result;
#[derive(Serialize, Deserialize, Debug)]
struct InsertQuery {
vector: Vec<f32>,
}
}

0 comments on commit 45d9d2c

Please sign in to comment.