Skip to content

Commit 962a491

Browse files
committed
Some docs
1 parent f6f9a0b commit 962a491

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/ra_analysis/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
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+
14
extern crate fst;
25
extern crate ra_editor;
36
extern crate ra_syntax;
@@ -95,6 +98,7 @@ impl AnalysisChange {
9598
}
9699
}
97100

101+
/// `AnalysisHost` stores the current state of the world.
98102
#[derive(Debug)]
99103
pub struct AnalysisHost {
100104
imp: AnalysisHostImpl,
@@ -106,11 +110,15 @@ impl AnalysisHost {
106110
imp: AnalysisHostImpl::new(),
107111
}
108112
}
113+
/// Returns a snapshot of the current state, which you can query for
114+
/// semantic information.
109115
pub fn analysis(&self) -> Analysis {
110116
Analysis {
111117
imp: self.imp.analysis(),
112118
}
113119
}
120+
/// Applies changes to the current state of the world. If there are
121+
/// outstanding snapshots, they will be canceled.
114122
pub fn apply_change(&mut self, change: AnalysisChange) {
115123
self.imp.apply_change(change)
116124
}
@@ -191,6 +199,10 @@ impl Query {
191199
}
192200
}
193201

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)`).
194206
#[derive(Debug)]
195207
pub struct Analysis {
196208
pub(crate) imp: AnalysisImpl,

0 commit comments

Comments
 (0)