Skip to main content

Crate detrix_rs

Crate detrix_rs 

Source
Expand description

Detrix Rust Client Library

Debug-on-demand observability for Rust applications. This client enables AI-powered debugging of running Rust processes without code modifications or restarts.

§Quick Start

use detrix_rs::Config;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize client (starts control plane, stays SLEEPING)
    detrix_rs::init(Config::default())?;

    // Your application code runs normally...

    // When debugging is needed, call /detrix/wake on the control plane
    // Or programmatically:
    // detrix_rs::wake()?;

    detrix_rs::shutdown()?;
    Ok(())
}

§Architecture

The client follows the same pattern as the Python and Go clients:

  1. SLEEPING: Zero overhead. Only control plane HTTP server running.
  2. WAKING: Transitional state during wake operation.
  3. AWAKE: lldb-dap attached, registered with daemon, ready for metrics.

Unlike Python’s debugpy, lldb-dap can be fully stopped on sleep, providing cleaner resource management.

Structs§

Config
Configuration for the Detrix client.
DiscoverResponse
Daemon discovery response (no auth required)
SleepResponse
Response from sleep operation
StatusResponse
Current client status
TlsConfig
TLS configuration for daemon communication.
WakeResponse
Response from wake operation

Enums§

ClientState
Client state machine state:
Error
Error type for Detrix client operations.
SleepResponseStatus
“sleeping” if the client transitioned from awake to sleeping. “already_sleeping” if the client was already in sleeping state.
WakeResponseStatus
“awake” if the client transitioned from sleeping to awake. “already_awake” if the client was already in awake state.

Functions§

init
Initialize the Detrix client.
shutdown
Shutdown the client and clean up resources.
sleep
Put the client to sleep: stop debugger and unregister from daemon.
status
Get the current client status.
wake
Wake the client: start debugger and register with daemon.
wake_with_url
Wake the client with a daemon URL override.

Type Aliases§

Result
Result type alias for Detrix client operations.