1
+ //! ra_analyzer crate is the brain of Rust analyzer. It relies on the `salsa`
2
+ //! crate, which provides and incremental on-deman database of facts.
3
+
1
4
extern crate fst;
2
5
extern crate ra_editor;
3
6
extern crate ra_syntax;
@@ -95,6 +98,7 @@ impl AnalysisChange {
95
98
}
96
99
}
97
100
101
+ /// `AnalysisHost` stores the current state of the world.
98
102
#[ derive( Debug ) ]
99
103
pub struct AnalysisHost {
100
104
imp : AnalysisHostImpl ,
@@ -106,11 +110,15 @@ impl AnalysisHost {
106
110
imp : AnalysisHostImpl :: new ( ) ,
107
111
}
108
112
}
113
+ /// Returns a snapshot of the current state, which you can query for
114
+ /// semantic information.
109
115
pub fn analysis ( & self ) -> Analysis {
110
116
Analysis {
111
117
imp : self . imp . analysis ( ) ,
112
118
}
113
119
}
120
+ /// Applies changes to the current state of the world. If there are
121
+ /// outstanding snapshots, they will be canceled.
114
122
pub fn apply_change ( & mut self , change : AnalysisChange ) {
115
123
self . imp . apply_change ( change)
116
124
}
@@ -191,6 +199,10 @@ impl Query {
191
199
}
192
200
}
193
201
202
+ /// Analysis is a snapshot of a world state at a moment in time. It is the main
203
+ /// entry point for asking semantic information about the world. When the world
204
+ /// state is advanced using `AnalysisHost::apply_change` method, all existing
205
+ /// `Analysis` are canceled (most method return `Err(Canceled)`).
194
206
#[ derive( Debug ) ]
195
207
pub struct Analysis {
196
208
pub ( crate ) imp : AnalysisImpl ,
0 commit comments