@@ -15,29 +15,26 @@ pub mod creds;
1515
1616pub const DEFAULT_API_URL : & str = "https://api.harmont.dev" ;
1717
18- /// Execution backend for `hm run`. Closed set parsed at the config boundary so
19- /// invalid values are rejected at deserialize time instead of mis-dispatching
20- /// later, and every consumer match is exhaustively checked by the compiler.
21- #[ derive( Debug , Copy , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
18+ /// Execution backend for `hm run`.
19+ ///
20+ /// Closed set parsed at the config boundary so invalid values are rejected at
21+ /// deserialize time instead of mis-dispatching later, and every consumer match
22+ /// is exhaustively checked by the compiler.
23+ #[ derive( Debug , Default , Copy , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
2224#[ serde( rename_all = "lowercase" ) ]
2325pub enum Backend {
26+ #[ default]
2427 Docker ,
2528 Cloud ,
2629}
2730
28- impl Default for Backend {
29- fn default ( ) -> Self {
30- Backend :: Docker
31- }
32- }
33-
3431impl Backend {
3532 /// Stable lowercase wire/CLI name (matches the `serde` representation).
3633 #[ must_use]
37- pub fn as_str ( self ) -> & ' static str {
34+ pub const fn as_str ( self ) -> & ' static str {
3835 match self {
39- Backend :: Docker => "docker" ,
40- Backend :: Cloud => "cloud" ,
36+ Self :: Docker => "docker" ,
37+ Self :: Cloud => "cloud" ,
4138 }
4239 }
4340}
@@ -78,7 +75,7 @@ impl Default for Preferences {
7875 }
7976}
8077
81- #[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
78+ #[ derive( Debug , Default , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
8279pub struct Config {
8380 #[ serde( default ) ]
8481 pub backend : Backend ,
@@ -88,16 +85,6 @@ pub struct Config {
8885 pub preferences : Preferences ,
8986}
9087
91- impl Default for Config {
92- fn default ( ) -> Self {
93- Self {
94- backend : Backend :: default ( ) ,
95- cloud : CloudConfig :: default ( ) ,
96- preferences : Preferences :: default ( ) ,
97- }
98- }
99- }
100-
10188impl Config {
10289 /// XDG-aware user config path (`~/.config/hm/config.toml`).
10390 ///
0 commit comments