Skip to main content

globetrotter_rust/
config.rs

1//! Rust output configuration.
2
3use std::path::PathBuf;
4
5/// Configuration for Rust translation code generation outputs.
6#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8pub struct OutputConfig {
9    /// File system paths where generated Rust translation bindings will be written.
10    #[cfg_attr(feature = "serde", serde(default))]
11    pub output_paths: Vec<PathBuf>,
12}
13
14impl OutputConfig {
15    /// Creates an output configuration from its destination paths.
16    pub fn new(paths: impl IntoIterator<Item = PathBuf>) -> Self {
17        Self {
18            output_paths: paths.into_iter().collect(),
19        }
20    }
21
22    /// Returns `true` if there are no configured output paths.
23    #[must_use]
24    pub fn is_empty(&self) -> bool {
25        self.output_paths.is_empty()
26    }
27}