| Crates.io | axcp-sdk |
| lib.rs | axcp-sdk |
| version | 0.3.11-beta |
| created_at | 2025-06-09 20:41:47.414595+00 |
| updated_at | 2025-07-12 18:34:47.950724+00 |
| description | Rust client SDK for AXCP protocol |
| homepage | |
| repository | https://github.com/tradephantom/axcp-spec |
| max_upload_size | |
| id | 1706379 |
| size | 90,879 |
Official Rust implementation of the Adaptive eXchange Context Protocol (AXCP) client SDK.
tokiothiserrortracingAdd this to your Cargo.toml:
[dependencies]
axcp-rs = "0.1.0-alpha.1"
# For async runtime (if not already in your project)
tokio = { version = "1.0", features = ["full"] }
default: Uses native-tls for TLSrustls: Use rustls instead of native-tlsdev: Include development dependencies for testing[dependencies]
axcp-rs = { version = "0.1.0-alpha.1", default-features = false, features = ["rustls"] }
use axcp_rs::prelude::*;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Initialize the SDK
axcp_rs::init()?;
// Create a client with default configuration
let config = ClientConfig {
base_url: "http://localhost:8080".to_string(),
api_key: Some("your-api-key".to_string()),
..Default::default()
};
let client = Client::new(config)?;
// Send telemetry data
let telemetry = client.telemetry();
telemetry.record_metric("cpu.usage", 75.5).await?;
// Or use the builder for more complex metrics
let data = TelemetryBuilder::new("memory.used", 1024.0)
.with_tag("host", "server-1")
.with_tag("region", "us-west-2")
.build();
client.telemetry().record(data).await?;
Ok(())
}
The ClientConfig struct supports the following options:
base_url: The base URL of the AXCP server (default: http://localhost:8080)api_key: Optional API key for authenticationtimeout_secs: Request timeout in seconds (default: 30)enable_telemetry: Whether to enable telemetry collection (default: true)Run the tests with:
cargo test
Apache 2.0