Skip to main content

cargo_dist/config/v1/installers/
shell.rs

1//! shell installer config
2
3use super::*;
4
5/// Options for shell installer
6#[derive(Debug, Default, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "kebab-case")]
8pub struct ShellInstallerLayer {
9    /// Common options
10    #[serde(flatten)]
11    pub common: CommonInstallerLayer,
12}
13/// Options for shell installer
14#[derive(Debug, Default, Clone)]
15pub struct ShellInstallerConfig {
16    /// Common options
17    pub common: CommonInstallerConfig,
18}
19
20impl ShellInstallerConfig {
21    /// Get defaults for the given package
22    pub fn defaults_for_package(
23        _workspaces: &WorkspaceGraph,
24        _pkg_idx: PackageIdx,
25        common: &CommonInstallerConfig,
26    ) -> Self {
27        Self {
28            common: common.clone(),
29        }
30    }
31}
32
33impl ApplyLayer for ShellInstallerConfig {
34    type Layer = ShellInstallerLayer;
35    fn apply_layer(&mut self, Self::Layer { common }: Self::Layer) {
36        self.common.apply_layer(common);
37    }
38}
39impl ApplyLayer for ShellInstallerLayer {
40    type Layer = ShellInstallerLayer;
41    fn apply_layer(&mut self, Self::Layer { common }: Self::Layer) {
42        self.common.apply_layer(common);
43    }
44}
45
46impl std::ops::Deref for ShellInstallerConfig {
47    type Target = CommonInstallerConfig;
48    fn deref(&self) -> &Self::Target {
49        &self.common
50    }
51}