Skip to main content

chaste_types/
installation.rs

1// SPDX-FileCopyrightText: 2024 The Chaste Authors
2// SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3
4use crate::error::Result;
5use crate::module_path::ModulePath;
6use crate::package::PackageID;
7
8#[derive(Debug, Clone)]
9pub struct Installation {
10    package_id: PackageID,
11    path: ModulePath,
12}
13
14impl Installation {
15    pub fn package_id(&self) -> PackageID {
16        self.package_id
17    }
18
19    pub fn path(&self) -> &ModulePath {
20        &self.path
21    }
22}
23
24#[derive(Debug)]
25pub struct InstallationBuilder {
26    package_id: PackageID,
27    path: ModulePath,
28}
29
30impl InstallationBuilder {
31    pub fn new(package_id: PackageID, path: ModulePath) -> Self {
32        Self { package_id, path }
33    }
34
35    pub fn build(self) -> Result<Installation> {
36        Ok(Installation {
37            package_id: self.package_id,
38            path: self.path,
39        })
40    }
41}