SDKs
Available

Rust

Add the loams crate and make the first call from Rust.

One Loams client with namespaced modules over the unified Connect API, generated from the protos. loams = "0.1" stays on the 0.1 line.

Examples: github.com/ostrium-labs/loams-rust · Source: sdks/rust

Install

cargo add loams
cargo add tokio --features macros,rt-multi-thread

The generated code comes from loams-proto and loams-live-proto, which run protoc at build time: install it first (apt install protobuf-compiler, brew install protobuf). The default tls feature brings rustls for https:// endpoints; a loopback http:// endpoint such as loams dev needs none of it (default-features = false).

Quickstart

use std::sync::Arc;
use loams::{ApiKey, CallOptionsOverrides, GetInstanceRequest, Loams, TransportOptions};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let loams = Loams::connect(TransportOptions::new("http://127.0.0.1:8080"))?
        .with_auth(Arc::new(ApiKey::new(std::env::var("LOAMS_API_KEY").unwrap_or_default())?));

    // The first call any client makes: what this instance is, and no auth.
    let info = loams.instance().get_instance(GetInstanceRequest::default(), CallOptionsOverrides::new()).await?;
    println!("{} serves {:?}", info.name, info.api_versions);
    Ok(())
}

Collections and hybrid search are not in the SDK facade in 0.1.0; call the REST API with an HTTP client such as reqwest.

On this page