The Rust SDK for Axiom — manage datasets, ingest and query data all from your Rust project.
Add the following to your Cargo.toml:
[dependencies]
axiom-rs = "0.1"
This library uses Tokio by default, so your Cargo.toml
could look like this:
[dependencies]
axiom-rs = "0.1"
tokio = "1"
Usage with async-std
If you want to use async-std, you need to set some features:
[dependencies]
axiom-rs = { version = "0.1", default-features = false, features = ["async-std"] }
async-std = "1"
And your src/main.rs
like this:
use axiom_rs::Client;
#[tokio::main] // or #[async_std::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new()?;
let datasets = client.datasets.list().await?;
println!("{:?}", datasets);
Ok(())
}
Note: The
Client
constructor usesAXIOM_TOKEN
and other parameters from your environment by default. See theClient
documentation for other options.
The following are a list of Cargo features that can be enabled or disabled:
- default-tls (enabled by default): Provides TLS support to connect over HTTPS.
- native-tls: Enables TLS functionality provided by
native-tls
. - rustls-tls: Enables TLS functionality provided by
rustls
. - tokio (enabled by default): Enables the usage with the
tokio
runtime. - async-std : Enables the usage with the
async-std
runtime.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.