kmmp-project-manager 0.1.0

kmmp-project-manager is a Rust crate for Kotlin Multiplatform (KMP) projects, offering a lightweight alternative to Android Studio. It provides tools for project creation, structure management, build automation, code generation, IDE integration, dependency management, and project configuration.
Documentation
use crate::Dependency;

use serde::{Deserialize,Serialize};

/// Represents a collection of dependencies.
#[derive(Deserialize, Serialize, Debug, PartialEq, PartialOrd )]
#[serde(bound(deserialize = "'de: 'a"))]
pub struct Dependencies<'a> (Vec<Dependency<'a>>);

impl<'a> Dependencies<'a> {
    /// Returns a reference to the underlying vector of dependencies.
    pub fn as_list(&self) -> &Vec<Dependency<'a>> {
        &self.0
    }
}

impl<'a> From<Vec<Dependency<'a>>> for Dependencies<'a> {
    /// Creates a new `Dependencies` instance from vector.
    ///
    /// # Example
    ///
    /// ```
    /// use kmmp_project_manager::{Dependency,Dependencies};
    /// 
    /// let dependencies = vec![
    ///     Dependency::new(/* dependency details */),
    ///     // Add more dependencies if needed
    /// ];
    ///
    /// let deps = Dependencies::from(dependencies);
    /// ```
    fn from(vector : Vec<Dependency<'a>>) -> Self {
        Self(vector)
    }
}

impl std::fmt::Display for Dependencies<'_> {
    /// Formats the `Dependencies` as a string.
    ///
    /// # Example
    ///
    /// ```
    /// use kmmp_project_manager::{Dependency,Dependencies};
    ///
    /// let dependencies = vec![
    ///     Dependency::new(/* dependency details */),
    ///     // Add more dependencies if needed
    /// ];
    ///
    /// let deps = Dependencies::new(&dependencies);
    /// assert_eq!(deps.to_string(), "dependencies {\n    /* formatted list of dependencies */\n}\n");
    /// ```
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f,"dependencies {{\n")?;
        for dependency in &self.0 {
            write!(f, "    {}\n", dependency.to_string())?;
        };
        write!(f,"}}\n")
    }
}