mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-18 17:40:29 +00:00
Add target_directory
path to CargoWorkspace
This commit is contained in:
parent
a48e0e14e1
commit
fc888b583d
1 changed files with 9 additions and 1 deletions
|
@ -32,6 +32,7 @@ pub struct CargoWorkspace {
|
|||
packages: Arena<PackageData>,
|
||||
targets: Arena<TargetData>,
|
||||
workspace_root: AbsPathBuf,
|
||||
target_directory: AbsPathBuf,
|
||||
}
|
||||
|
||||
impl ops::Index<Package> for CargoWorkspace {
|
||||
|
@ -414,7 +415,10 @@ impl CargoWorkspace {
|
|||
let workspace_root =
|
||||
AbsPathBuf::assert(PathBuf::from(meta.workspace_root.into_os_string()));
|
||||
|
||||
CargoWorkspace { packages, targets, workspace_root }
|
||||
let target_directory =
|
||||
AbsPathBuf::assert(PathBuf::from(meta.target_directory.into_os_string()));
|
||||
|
||||
CargoWorkspace { packages, targets, workspace_root, target_directory }
|
||||
}
|
||||
|
||||
pub fn packages(&self) -> impl Iterator<Item = Package> + ExactSizeIterator + '_ {
|
||||
|
@ -432,6 +436,10 @@ impl CargoWorkspace {
|
|||
&self.workspace_root
|
||||
}
|
||||
|
||||
pub fn target_directory(&self) -> &AbsPath {
|
||||
&self.target_directory
|
||||
}
|
||||
|
||||
pub fn package_flag(&self, package: &PackageData) -> String {
|
||||
if self.is_unique(&package.name) {
|
||||
package.name.clone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue