use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ComponentManifest {
pub name: String,
pub version: String,
pub crate_name: String,
pub features: Vec<String>,
}
impl ComponentManifest {
pub fn new(
name: impl Into<String>,
version: impl Into<String>,
crate_name: impl Into<String>,
) -> Self {
Self {
name: name.into(),
version: version.into(),
crate_name: crate_name.into(),
features: Vec::new(),
}
}
pub fn with_features(mut self, features: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.features = features.into_iter().map(Into::into).collect();
self
}
pub fn entrenar_core(version: &str) -> Self {
Self::new("entrenar-core", version, "entrenar")
}
pub fn trueno(version: &str) -> Self {
Self::new("trueno", version, "trueno")
}
pub fn aprender(version: &str) -> Self {
Self::new("aprender", version, "aprender")
}
pub fn renacer(version: &str) -> Self {
Self::new("renacer", version, "renacer")
}
}