entrenar/sovereign/distribution/
component.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7pub struct ComponentManifest {
8 pub name: String,
10 pub version: String,
12 pub crate_name: String,
14 pub features: Vec<String>,
16}
17
18impl ComponentManifest {
19 pub fn new(
21 name: impl Into<String>,
22 version: impl Into<String>,
23 crate_name: impl Into<String>,
24 ) -> Self {
25 Self {
26 name: name.into(),
27 version: version.into(),
28 crate_name: crate_name.into(),
29 features: Vec::new(),
30 }
31 }
32
33 pub fn with_features(mut self, features: impl IntoIterator<Item = impl Into<String>>) -> Self {
35 self.features = features.into_iter().map(Into::into).collect();
36 self
37 }
38
39 pub fn entrenar_core(version: &str) -> Self {
41 Self::new("entrenar-core", version, "entrenar")
42 }
43
44 pub fn trueno(version: &str) -> Self {
46 Self::new("trueno", version, "trueno")
47 }
48
49 pub fn aprender(version: &str) -> Self {
51 Self::new("aprender", version, "aprender")
52 }
53
54 pub fn renacer(version: &str) -> Self {
56 Self::new("renacer", version, "renacer")
57 }
58}