| Crates.io | spatio-client |
| lib.rs | spatio-client |
| version | 0.2.4 |
| created_at | 2026-01-08 14:47:27.681106+00 |
| updated_at | 2026-01-12 15:50:38.696618+00 |
| description | Native Rust RPC client for Spatio database |
| homepage | |
| repository | https://github.com/pkvartsianyi/spatio |
| max_upload_size | |
| id | 2030377 |
| size | 89,399 |
A lightweight, native Rust RPC client for connecting to remote Spatio database servers.
spatio-client provides a high-performance, async client for interacting with spatio-server instances over TCP. It uses the same binary RPC protocol as the server for maximum efficiency.
tokio for non-blocking I/Ouse spatio_client::SpatioClient;
use spatio_types::point::Point3d;
use std::time::Duration;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Connect to a remote server
let client = SpatioClient::new("127.0.0.1".to_string(), 3000)
.with_timeout(Duration::from_secs(5));
// Perform operations
let nyc = Point3d::new(-74.0060, 40.7128, 0.0);
client.upsert("cities", "nyc", nyc, serde_json::json!({"pop": 8000000}), None).await?;
// Query
let nearby = client.query_radius("cities", &nyc, 100_000.0, 10).await?;
println!("Found {} nearby cities", nearby.len());
Ok(())
}
The client mirrors the embedded database API:
upsert(namespace, object_id, position, metadata, options)get(namespace, object_id)delete(namespace, object_id)query_radius(namespace, center, radius, limit)query_bbox(namespace, min_x, min_y, max_x, max_y, limit)knn(namespace, center, k)stats()The client uses bincode for serialization and length-delimited framing for minimal overhead. Typical latency for local connections is sub-millisecond.
MIT - see LICENSE