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    /// # Arguments
8    ///
9    /// - `Self` - CLI render mode argument.
10    ///
11    /// # Returns
12    ///
13    /// - `RenderMode` - Core rendering pipeline mode.
14    #[must_use]
15    pub const fn to_render_mode(self) -> RenderMode {
16        match self {
17            Self::Auto => RenderMode::Auto,
18            Self::Software => RenderMode::Software,
19            Self::Hardware => RenderMode::Hardware,
20            Self::Hybrid => RenderMode::Hybrid,
21        }
22    }
23
24    /// Returns the CLI flag string forwarded to `euv` applications.
25    ///
26    /// # Arguments
27    ///
28    /// - `Self` - CLI render mode argument.
29    ///
30    /// # Returns
31    ///
32    /// - `&'static str` - Render flag token.
33    #[must_use]
34    pub const fn as_flag(self) -> &'static str {
35        match self {
36            Self::Auto => RENDER_FLAG_AUTO,
37            Self::Software => RENDER_FLAG_SOFTWARE,
38            Self::Hardware => RENDER_FLAG_HARDWARE,
39            Self::Hybrid => RENDER_FLAG_HYBRID,
40        }
41    }
42}