A Rust client library for the Zinit service manager.
- Zero Configuration: Automatically detects server version and protocol
- Complete API: All Zinit operations (list, start, stop, create, delete, etc.)
- Async/Await: Built on Tokio for high performance
- Type Safe: Strongly typed service states and responses
- Error Handling: Comprehensive error types with helpful messages
- Backward Compatible: Works with legacy Zinit installations
Add this to your Cargo.toml:
[dependencies]
zinit-client = "0.4.0"use zinit_client::ZinitClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZinitClient::new("/var/run/zinit.sock");
    // List all services
    let services = client.list().await?;
    println!("Services: {:?}", services);
    // Start a service
    client.start("my-service").await?;
    // Get service status
    let status = client.status("my-service").await?;
    println!("Status: {:?}", status);
    Ok(())
}// List all services
let services = client.list().await?;
// Service lifecycle
client.start("service-name").await?;
client.stop("service-name").await?;
client.restart("service-name").await?;
// Get detailed status
let status = client.status("service-name").await?;
// Create/delete services (if supported by server)
client.create_service("name", config).await?;
client.delete_service("name").await?;Run the demo to see the universal interface in action:
cargo run --example <example_name> <sock_path>For detailed API documentation, visit docs.rs/zinit-client.
This project is licensed under the MIT License - see the LICENSE file for details.