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::SourceSet;

use serde::{Serialize,Deserialize};

/// Represents a collection of source sets in a Kotlin Multiplatform project.
#[derive(Deserialize, Serialize, Debug, PartialEq)]
#[serde(bound(deserialize = "'de: 'a"))]
pub struct SourceSets<'a>(Vec<SourceSet<'a>>);

impl SourceSets<'_> {
    /// Returns a reference to the underlying vector of source sets.
    pub fn as_list(&self) -> &Vec<SourceSet<'_>> {
        &self.0
    }
}

impl<'a> From<Vec<SourceSet<'a>>> for SourceSets<'a> {
    /// Creates a new `SourceSets` instance with the specified source sets.
    ///
    /// # Arguments
    ///
    /// * `source_sets` - The source sets.
    ///
    /// # Example
    ///
    /// ```
    /// let source_sets = SourceSets::from(&Vec::new());
    /// ```
    fn from(vector : Vec<SourceSet<'a>>) -> Self {
        Self(vector)  
    }
}

impl std::fmt::Display for SourceSets<'_> {
    /// Formats the `SourceSets` as a string.
    ///
    /// # Example
    ///
    /// ```
    /// use kmmp_structure::gradle::{
    ///     SourceSet,
    ///     sourcesets::SourceMethod,
    ///     SourceSets
    /// };
    ///
    /// let source_set = SourceSet::new("main", SourceMethod::Kotlin, &HashMap::new(), Dependencies::new(&Vec::new()));
    /// let source_sets = SourceSets::new(&vec![source_set]);
    /// assert_eq!(
    ///     source_sets.to_string(),
    ///     "sourcesets {\n    val main by SourceMethod.Kotlin { }\n}\n"
    /// );
    /// ```
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f,"sourcesets {{\n")?;
        for source_set in &self.0 {
            write!(f,"{}",source_set.to_string())?;
        };
        write!(f,"}}\n")
    }
}