mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Expose iterators over an inference result's types
(This re-introduces a reduced access to a couple of previously public fields on `InferenceResult`)
This commit is contained in:
parent
f6cf3035c3
commit
7e9abceee7
1 changed files with 20 additions and 0 deletions
|
|
@ -632,6 +632,26 @@ impl InferenceResult {
|
|||
pub fn binding_mode(&self, id: PatId) -> Option<BindingMode> {
|
||||
self.binding_modes.get(id).copied()
|
||||
}
|
||||
|
||||
// This method is consumed by external tools to run rust-analyzer as a library. Don't remove, please.
|
||||
pub fn expression_types(&self) -> impl Iterator<Item = (ExprId, &Ty)> {
|
||||
self.type_of_expr.iter()
|
||||
}
|
||||
|
||||
// This method is consumed by external tools to run rust-analyzer as a library. Don't remove, please.
|
||||
pub fn pattern_types(&self) -> impl Iterator<Item = (PatId, &Ty)> {
|
||||
self.type_of_pat.iter()
|
||||
}
|
||||
|
||||
// This method is consumed by external tools to run rust-analyzer as a library. Don't remove, please.
|
||||
pub fn binding_types(&self) -> impl Iterator<Item = (BindingId, &Ty)> {
|
||||
self.type_of_binding.iter()
|
||||
}
|
||||
|
||||
// This method is consumed by external tools to run rust-analyzer as a library. Don't remove, please.
|
||||
pub fn return_position_impl_trait_types(&self) -> impl Iterator<Item = (ImplTraitIdx, &Ty)> {
|
||||
self.type_of_rpit.iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl Index<ExprId> for InferenceResult {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue