helm-rs 0.1.1

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! The derived builders build what the struct literals and `new` build, and their collection
//! setters add and replace.

/// Asserts, for each `"label": built == expected;` row, that the builder-built command equals
/// the literal one.
macro_rules! assert_builds {
    ($($label:literal: $built:expr => $expected:expr;)*) => {
        $(assert_eq!($built, $expected, $label);)*
    };
}

/// Asserts for a `Vec` field that the single-item setter appends to what the start already put
/// there (`$prefix`) and that the whole-collection setter replaces it. `$ty` is the item type.
macro_rules! assert_vec_setters {
    ($start:expr, $field:ident, $single:ident, $whole:ident, $ty:ty, $prefix:expr, $items:expr) => {{
        let items: Vec<$ty> = Vec::<&str>::from($items)
            .into_iter()
            .map(<$ty>::from)
            .collect();
        let mut appended: Vec<$ty> = Vec::<&str>::from($prefix)
            .into_iter()
            .map(<$ty>::from)
            .collect();

        appended.extend(items[..2].iter().cloned());

        assert_eq!(
            $start
                .$single(items[0].clone())
                .$single(items[1].clone())
                .build()
                .$field,
            appended,
            concat!(stringify!($single), " appends")
        );
        assert_eq!(
            $start
                .$single(items[0].clone())
                .$whole(items[1..].to_vec())
                .build()
                .$field,
            items[1..],
            concat!(stringify!($whole), " replaces")
        );
    }};
}

/// Asserts that the builder expression does not implement `Debug`, so it cannot print the
/// secret it holds.
macro_rules! assert_not_debug {
    ($builder:expr) => {{
        trait NotDebug {
            fn is_debug(&self) -> bool {
                false
            }
        }

        struct Probe<T>(T);

        impl<T> NotDebug for Probe<T> {}

        #[allow(
            dead_code,
            reason = "it exists to win method resolution when `T` is `Debug`"
        )]
        impl<T: std::fmt::Debug> Probe<T> {
            fn is_debug(&self) -> bool {
                true
            }
        }

        assert!(!Probe($builder).is_debug(), "the builder must not be Debug");
    }};
}

mod fetch;
mod options;
mod plugin;
mod registry;
mod release;
mod render;
mod repo;
mod search_show;