Skip to main content

euv_cli/args/
impl.rs

1use super::*;
2
3/// Conversion helpers between CLI arguments and `euv-core` types.
4impl RenderArg {
5    /// Converts a `RenderArg` into the core `RenderMode` enum.
6    ///
7    /// # Returns
8    ///
9    /// - `RenderMode` - Core rendering pipeline mode.
10    #[must_use]
11    pub const fn to_render_mode(self) -> RenderMode {
12        match self {
13            Self::Auto => RenderMode::Auto,
14            Self::Software => RenderMode::Software,
15            Self::Hardware => RenderMode::Hardware,
16            Self::Hybrid => RenderMode::Hybrid,
17        }
18    }
19
20    /// Returns the CLI flag string forwarded to `euv` applications.
21    ///
22    /// # Returns
23    ///
24    /// - `&'static str` - Render flag token.
25    #[must_use]
26    pub const fn as_flag(self) -> &'static str {
27        match self {
28            Self::Auto => RENDER_FLAG_AUTO,
29            Self::Software => RENDER_FLAG_SOFTWARE,
30            Self::Hardware => RENDER_FLAG_HARDWARE,
31            Self::Hybrid => RENDER_FLAG_HYBRID,
32        }
33    }
34}
35
36/// Wire string helpers for `HarmonyFormFactorArg`.
37impl HarmonyFormFactorArg {
38    /// Returns the canonical lowercase form factor label passed to `build-harmony.sh`.
39    ///
40    /// # Returns
41    ///
42    /// - `&'static str` - Lowercase form factor label.
43    #[must_use]
44    pub const fn as_str(self) -> &'static str {
45        match self {
46            Self::Phone => HARMONY_FORM_PHONE,
47            Self::Tablet => HARMONY_FORM_TABLET,
48            Self::Pc => HARMONY_FORM_PC,
49            Self::Foldable => HARMONY_FORM_FOLDABLE,
50            Self::Tv => HARMONY_FORM_TV,
51            Self::Car => HARMONY_FORM_CAR,
52            Self::Wearable => HARMONY_FORM_WEARABLE,
53        }
54    }
55}