Skip to navigation

Lattice SDK for Rust (REST)

You can now build Lattice REST integrations in Rust. The Lattice SDK for Rust is published to crates.io as anduril-lattice-sdk, joining the existing Go, Java, Python, and TypeScript REST SDKs. The Lattice SDK guides now carry REST-based Rust examples alongside every other language, including publishing entities.

Add the SDK to your project

Install the SDK with cargo add anduril-lattice-sdk, then add the tokio runtime it builds on with cargo add tokio --features macros,rt-multi-thread. The SDK enables a rustls TLS backend by default, so HTTPS requests work without any additional dependencies.

The entire API surface is available through a single prelude, so you import the client and every type you need in one line. The following example publishes a drone asset entity:

Rust (REST)
use anduril_lattice_sdk::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig {
base_url: format!("https://{}", lattice_endpoint),
token: Some(environment_token),
..Default::default()
};
let client = Lattice::new(config)?;
let entity = Entity {
entity_id: Some("drone-1".to_string()),
is_live: Some(true),
aliases: Some(Aliases {
name: Some("Drone 1".to_string()),
..Default::default()
}),
ontology: Some(Ontology {
template: Some(OntologyTemplate::TemplateAsset),
platform_type: Some("UAV".to_string()),
..Default::default()
}),
mil_view: Some(MilView {
disposition: Some(MilViewDisposition::DispositionFriendly),
environment: Some(MilViewEnvironment::EnvironmentAir),
..Default::default()
}),
..Default::default()
};
client.entities.publish_entity(&entity, None).await?;
Ok(())
}

To get started, install the SDK for REST and follow the guides.