Skip to main content

changeset_operations/traits/
project_provider.rs

1use std::collections::HashMap;
2use std::path::{Path, PathBuf};
3
4use changeset_project::{CargoProject, PackageChangesetConfig, RootChangesetConfig};
5
6use crate::Result;
7
8pub trait ProjectProvider: Send + Sync {
9    /// # Errors
10    ///
11    /// Returns an error if no project can be found from the given path.
12    fn discover_project(&self, start_path: &Path) -> Result<CargoProject>;
13
14    /// # Errors
15    ///
16    /// Returns an error if the configuration files cannot be loaded.
17    fn load_configs(
18        &self,
19        project: &CargoProject,
20    ) -> Result<(RootChangesetConfig, HashMap<String, PackageChangesetConfig>)>;
21
22    /// # Errors
23    ///
24    /// Returns an error if the changeset directory cannot be created.
25    fn ensure_changeset_dir(
26        &self,
27        project: &CargoProject,
28        config: &RootChangesetConfig,
29    ) -> Result<PathBuf>;
30}