mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +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>,
|
packages: Arena<PackageData>,
|
||||||
targets: Arena<TargetData>,
|
targets: Arena<TargetData>,
|
||||||
workspace_root: AbsPathBuf,
|
workspace_root: AbsPathBuf,
|
||||||
|
target_directory: AbsPathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ops::Index<Package> for CargoWorkspace {
|
impl ops::Index<Package> for CargoWorkspace {
|
||||||
|
@ -414,7 +415,10 @@ impl CargoWorkspace {
|
||||||
let workspace_root =
|
let workspace_root =
|
||||||
AbsPathBuf::assert(PathBuf::from(meta.workspace_root.into_os_string()));
|
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 + '_ {
|
pub fn packages(&self) -> impl Iterator<Item = Package> + ExactSizeIterator + '_ {
|
||||||
|
@ -432,6 +436,10 @@ impl CargoWorkspace {
|
||||||
&self.workspace_root
|
&self.workspace_root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn target_directory(&self) -> &AbsPath {
|
||||||
|
&self.target_directory
|
||||||
|
}
|
||||||
|
|
||||||
pub fn package_flag(&self, package: &PackageData) -> String {
|
pub fn package_flag(&self, package: &PackageData) -> String {
|
||||||
if self.is_unique(&package.name) {
|
if self.is_unique(&package.name) {
|
||||||
package.name.clone()
|
package.name.clone()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue