2 unstable releases

new 0.2.0 Mar 6, 2025
0.1.0 Aug 6, 2022
0.0.0 Apr 24, 2021

#81 in #api-key

Download history 6/week @ 2024-11-16 3/week @ 2024-11-23 18/week @ 2024-11-30 36/week @ 2024-12-07 25/week @ 2024-12-14 4/week @ 2024-12-21 51/week @ 2025-03-01

51 downloads per month
Used in serde_map

Apache-2.0

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