Skip to content

Commit fc888b5

Browse files
committed
Add target_directory path to CargoWorkspace
1 parent a48e0e1 commit fc888b5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/project-model/src/cargo_workspace.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub struct CargoWorkspace {
3232
packages: Arena<PackageData>,
3333
targets: Arena<TargetData>,
3434
workspace_root: AbsPathBuf,
35+
target_directory: AbsPathBuf,
3536
}
3637

3738
impl ops::Index<Package> for CargoWorkspace {
@@ -414,7 +415,10 @@ impl CargoWorkspace {
414415
let workspace_root =
415416
AbsPathBuf::assert(PathBuf::from(meta.workspace_root.into_os_string()));
416417

417-
CargoWorkspace { packages, targets, workspace_root }
418+
let target_directory =
419+
AbsPathBuf::assert(PathBuf::from(meta.target_directory.into_os_string()));
420+
421+
CargoWorkspace { packages, targets, workspace_root, target_directory }
418422
}
419423

420424
pub fn packages(&self) -> impl Iterator<Item = Package> + ExactSizeIterator + '_ {
@@ -432,6 +436,10 @@ impl CargoWorkspace {
432436
&self.workspace_root
433437
}
434438

439+
pub fn target_directory(&self) -> &AbsPath {
440+
&self.target_directory
441+
}
442+
435443
pub fn package_flag(&self, package: &PackageData) -> String {
436444
if self.is_unique(&package.name) {
437445
package.name.clone()

0 commit comments

Comments
 (0)