aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model/src/cargo_workspace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/project_model/src/cargo_workspace.rs')
-rw-r--r--crates/project_model/src/cargo_workspace.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index 1700cb8a7..0e6679542 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -80,19 +80,35 @@ pub type Package = Idx<PackageData>;
80 80
81pub type Target = Idx<TargetData>; 81pub type Target = Idx<TargetData>;
82 82
83/// Information associated with a cargo crate
83#[derive(Debug, Clone, Eq, PartialEq)] 84#[derive(Debug, Clone, Eq, PartialEq)]
84pub struct PackageData { 85pub struct PackageData {
86 /// Version given in the `Cargo.toml`
85 pub version: String, 87 pub version: String,
88 /// Name as given in the `Cargo.toml`
86 pub name: String, 89 pub name: String,
90 /// Path containing the `Cargo.toml`
87 pub manifest: AbsPathBuf, 91 pub manifest: AbsPathBuf,
92 /// Targets provided by the crate (lib, bin, example, test, ...)
88 pub targets: Vec<Target>, 93 pub targets: Vec<Target>,
94 /// Is this package a member of the current workspace
89 pub is_member: bool, 95 pub is_member: bool,
96 /// List of packages this package depends on
90 pub dependencies: Vec<PackageDependency>, 97 pub dependencies: Vec<PackageDependency>,
98 /// Rust edition for this package
91 pub edition: Edition, 99 pub edition: Edition,
100 /// List of features to activate
92 pub features: Vec<String>, 101 pub features: Vec<String>,
102 /// List of config flags defined by this package's build script
93 pub cfgs: Vec<CfgFlag>, 103 pub cfgs: Vec<CfgFlag>,
104 /// List of cargo-related environment variables with their value
105 ///
106 /// If the package has a build script which defines environment variables,
107 /// they can also be found here.
94 pub envs: Vec<(String, String)>, 108 pub envs: Vec<(String, String)>,
109 /// Directory where a build script might place its output
95 pub out_dir: Option<AbsPathBuf>, 110 pub out_dir: Option<AbsPathBuf>,
111 /// Path to the proc-macro library file if this package exposes proc-macros
96 pub proc_macro_dylib_path: Option<AbsPathBuf>, 112 pub proc_macro_dylib_path: Option<AbsPathBuf>,
97} 113}
98 114
@@ -102,12 +118,18 @@ pub struct PackageDependency {
102 pub name: String, 118 pub name: String,
103} 119}
104 120
121/// Information associated with a package's target
105#[derive(Debug, Clone, Eq, PartialEq)] 122#[derive(Debug, Clone, Eq, PartialEq)]
106pub struct TargetData { 123pub struct TargetData {
124 /// Package that provided this target
107 pub package: Package, 125 pub package: Package,
126 /// Name as given in the `Cargo.toml` or generated from the file name
108 pub name: String, 127 pub name: String,
128 /// Path to the main source file of the target
109 pub root: AbsPathBuf, 129 pub root: AbsPathBuf,
130 /// Kind of target
110 pub kind: TargetKind, 131 pub kind: TargetKind,
132 /// Is this target a proc-macro
111 pub is_proc_macro: bool, 133 pub is_proc_macro: bool,
112} 134}
113 135