dexcost
Rust

Installation

Install the dexcost Rust SDK with cargo add, including optional Cargo features and a verification snippet.

cargo add dexcost

Or add the dependency directly to your Cargo.toml:

[dependencies]
dexcost = "0.1"
tokio = { version = "1", features = ["full"] }

tokio with the full feature set is required because the SDK is async and built on the Tokio runtime.

Optional extras

The SDK ships several optional Cargo features. Each is disabled by default — enable only the ones you need to keep your build lean.

FeatureWhat it enablesHow to enable
reqwest-middlewareIntegrates with the reqwest-middleware crate so that HTTP requests made through a reqwest middleware stack are tracked automaticallydexcost = { version = "0.1", features = ["reqwest-middleware"] }
axum-middlewareProvides dexcost::middleware::axum::dexcost_middleware, a Tower-compatible layer for Axum routers that records per-request HTTP costsdexcost = { version = "0.1", features = ["axum-middleware"] }
tower-middlewareEnables Tower and tower-http integration for middleware stacks that are not Axum-specificdexcost = { version = "0.1", features = ["tower-middleware"] }
actix-middlewareProvides middleware for Actix Web 4 servicesdexcost = { version = "0.1", features = ["actix-middleware"] }
streamingEnables streaming response support via async-streamdexcost = { version = "0.1", features = ["streaming"] }
tracing-bridgeBridges dexcost events into the tracing ecosystem, emitting structured spans and events that any tracing-subscriber can consumedexcost = { version = "0.1", features = ["tracing-bridge"] }

To enable multiple features at once, list them in the features array:

[dependencies]
dexcost = { version = "0.1", features = ["axum-middleware", "streaming"] }

Requirements

Async Rust with the Tokio runtime. Rust edition 2021 (Rust 1.75+ for stable async trait support). The SQLite event buffer is bundled via rusqlite with the bundled feature — no separate SQLite installation is required.

Verify your install

After running cargo add dexcost, confirm the crate resolves and the SDK version constant is accessible:

fn main() {
    println!("{}", dexcost::VERSION);
}

This prints the installed SDK version (for example, 0.1.0). If the build fails, run cargo check and verify that dexcost appears in your Cargo.lock.

On this page