mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-25 21:04:32 +00:00
Don't expose indexing details
This commit is contained in:
parent
13fd8846b4
commit
9786a8f2d4
2 changed files with 20 additions and 24 deletions
|
@ -12,7 +12,7 @@ use crate::cfg_flag::CfgFlag;
|
|||
/// Roots and crates that compose this Rust project.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ProjectJson {
|
||||
pub(crate) crates: Vec<Crate>,
|
||||
crates: Vec<Crate>,
|
||||
}
|
||||
|
||||
/// A crate points to the root module of a crate and lists the dependencies of the crate. This is
|
||||
|
@ -79,6 +79,12 @@ impl ProjectJson {
|
|||
.collect::<Vec<_>>(),
|
||||
}
|
||||
}
|
||||
pub fn n_crates(&self) -> usize {
|
||||
self.crates.len()
|
||||
}
|
||||
pub fn crates(&self) -> impl Iterator<Item = (CrateId, &Crate)> + '_ {
|
||||
self.crates.iter().enumerate().map(|(idx, krate)| (CrateId(idx as u32), krate))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue