helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! The traits that connect typed commands to backends.

use std::future::Future;

use crate::error::Result;
use crate::options::GlobalOptions;

/// A typed Helm command (for example `Version`). The command struct holds the arguments and flags;
/// `Output` is what a successful run yields.
pub trait Command: Clone + Send + Sync + 'static {
    /// The parsed result of the command.
    type Output: Send + 'static;
}

/// Marker for types that can execute commands. A backend implements [`Execute`] for every command
/// it supports.
pub trait Backend: Send + Sync + 'static {}

/// A backend that can run the command `C`.
///
/// `Helm::run` is bounded on this trait, so a command the backend does not cover is a compile
/// error. Cancellation: dropping the returned future must not leave Helm state half-written where
/// avoidable; the CLI backend kills the process for read-only commands but lets mutating commands
/// (install, upgrade, rollback, ...) run to completion, because killing an upgrade leaves the
/// release in `pending-upgrade`.
pub trait Execute<C: Command>: Backend {
    /// Runs `command` with the given global options.
    fn execute(
        &self,
        options: &GlobalOptions,
        command: &C,
    ) -> impl Future<Output = Result<C::Output>> + Send;
}