2 unstable releases
new 0.2.0 | Mar 6, 2025 |
---|---|
0.1.0 | Aug 6, 2022 |
0.0.0 |
|
#81 in #api-key
51 downloads per month
Used in serde_map
18KB
313 lines
Typesense
Rust client library for Typesense
Examples
#[cfg(any(feature = "tokio_test", target_arch = "wasm32"))]
{
use serde::{Deserialize, Serialize};
use typesense::document::Document;
use typesense::Typesense;
use typesense::apis::collections_api;
use typesense::apis::configuration::{ApiKey, Configuration};
#[derive(Typesense, Serialize, Deserialize)]
#[typesense(collection_name = "companies", default_sorting_field = "num_employees")]
struct Company {
company_name: String,
num_employees: i32,
#[typesense(facet)]
country: String,
}
#[tokio::main]
async fn main() {
let config = Configuration {
base_path: "http://localhost:5000".to_owned(),
api_key: Some(ApiKey {
prefix: None,
key: "VerySecretKey".to_owned(),
}),
..Default::default()
};
let collection = collections_api::create_collection(&config, Company::collection_schema())
.await
.unwrap();
}
}
Dependencies
~6–17MB
~233K SLoC