harmos_packaging/
config.rs1use std::time::Duration;
20
21#[derive(Clone, Debug)]
34pub struct BuildSettings {
35 pub backend: BuildBackend,
36 pub manifest: std::path::PathBuf,
37 pub packages: Vec<String>,
38 pub target: Option<String>,
39 pub target_directory: Option<std::path::PathBuf>,
40 pub profile: BuildProfile,
41 pub timings: bool,
42 pub features: Vec<String>,
43 pub default_features: bool,
44}
45
46#[derive(Clone, Copy, Debug)]
47pub struct DevSettings {
48 pub debounce: Duration,
49}
50
51#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
52#[serde(rename_all = "snake_case")]
53pub enum BuildBackend {
54 Sidecar,
55 Guest,
56}
57
58#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
61#[serde(rename_all = "snake_case")]
62pub enum BuildProfile {
63 Dev,
64 Release,
65 Bench,
66}
67
68impl BuildProfile {
73 pub const fn name(self) -> &'static str {
74 match self {
75 Self::Dev => "dev",
76 Self::Release => "release",
77 Self::Bench => "bench",
78 }
79 }
80}
81
82impl std::str::FromStr for BuildProfile {
83 type Err = &'static str;
84 fn from_str(value: &str) -> Result<Self, Self::Err> {
85 match value {
86 "dev" => Ok(Self::Dev),
87 "release" => Ok(Self::Release),
88 "bench" => Ok(Self::Bench),
89 _ => Err("profile must be dev, release or bench"),
90 }
91 }
92}
93
94impl Default for BuildSettings {
95 fn default() -> Self {
96 Self {
97 backend: BuildBackend::Sidecar,
98 manifest: "Cargo.toml".into(),
99 packages: Vec::new(),
100 target: None,
101 target_directory: None,
102 profile: BuildProfile::Dev,
103 timings: false,
104 features: Vec::new(),
105 default_features: true,
106 }
107 }
108}
109
110impl Default for DevSettings {
111 fn default() -> Self {
112 Self { debounce: Duration::from_millis(100) }
113 }
114}
115
116