aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/project_model')
-rw-r--r--crates/project_model/src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/project_model/src/lib.rs b/crates/project_model/src/lib.rs
index 84d1303db..b601d7dc3 100644
--- a/crates/project_model/src/lib.rs
+++ b/crates/project_model/src/lib.rs
@@ -6,6 +6,7 @@ mod sysroot;
6mod cfg_flag; 6mod cfg_flag;
7 7
8use std::{ 8use std::{
9 fmt,
9 fs::{self, read_dir, ReadDir}, 10 fs::{self, read_dir, ReadDir},
10 io, 11 io,
11 process::Command, 12 process::Command,
@@ -27,7 +28,7 @@ pub use crate::{
27 28
28pub use proc_macro_api::ProcMacroClient; 29pub use proc_macro_api::ProcMacroClient;
29 30
30#[derive(Debug, Clone, Eq, PartialEq)] 31#[derive(Clone, Eq, PartialEq)]
31pub enum ProjectWorkspace { 32pub enum ProjectWorkspace {
32 /// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`. 33 /// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`.
33 Cargo { cargo: CargoWorkspace, sysroot: Sysroot }, 34 Cargo { cargo: CargoWorkspace, sysroot: Sysroot },
@@ -35,6 +36,19 @@ pub enum ProjectWorkspace {
35 Json { project: ProjectJson }, 36 Json { project: ProjectJson },
36} 37}
37 38
39impl fmt::Debug for ProjectWorkspace {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 match self {
42 ProjectWorkspace::Cargo { cargo, .. } => {
43 f.debug_struct("Cargo").field("n_packages", &cargo.packages().len()).finish()
44 }
45 ProjectWorkspace::Json { project } => {
46 f.debug_struct("Json").field("n_crates", &project.crates.len()).finish()
47 }
48 }
49 }
50}
51
38/// `PackageRoot` describes a package root folder. 52/// `PackageRoot` describes a package root folder.
39/// Which may be an external dependency, or a member of 53/// Which may be an external dependency, or a member of
40/// the current workspace. 54/// the current workspace.