#service-manager #client #zinit #init #client-service

zinit-client

A Rust client library for interacting with Zinit service manager

3 releases (breaking)

0.4.0 Jul 8, 2025
0.3.0 Jun 15, 2025
0.2.0 Jun 15, 2025

#992 in Asynchronous

Download history 2/week @ 2025-09-28 1/week @ 2025-10-05 3/week @ 2025-10-19 4/week @ 2025-10-26

152 downloads per month
Used in 6 crates (3 directly)

MIT license

56KB
1K SLoC

Zinit Client

Crates.io Documentation License: MIT

A Rust client library for the Zinit service manager.

Universal Compatibility: Automatically works with both old (v0.2.14) and new (v0.2.25+) Zinit servers through automatic protocol detection.

Features

  • 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

Installation

Add this to your Cargo.toml:

[dependencies]
zinit-client = "0.4.0"

Quick Start

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(())
}

API Overview

Service Management

// 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?;

Examples

Run the demo to see the universal interface in action:

cargo run --example <example_name> <sock_path>

Documentation

For detailed API documentation, visit docs.rs/zinit-client.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~5–9.5MB
~167K SLoC