aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-01 11:31:25 +0000
committerAleksey Kladov <[email protected]>2018-11-01 11:31:35 +0000
commit962a491829c2a803f5dc8c8c5e173baa89079e8b (patch)
tree9315ed8fc3926c87d1da830eb7e554c0ed80590a /crates/ra_analysis
parentf6f9a0bf35f073e554a340f04e213867732d81a1 (diff)
Some docs
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 32aa7a1fd..d21be3a88 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -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
1extern crate fst; 4extern crate fst;
2extern crate ra_editor; 5extern crate ra_editor;
3extern crate ra_syntax; 6extern 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#[derive(Debug)] 102#[derive(Debug)]
99pub struct AnalysisHost { 103pub struct AnalysisHost {
100 imp: AnalysisHostImpl, 104 imp: AnalysisHostImpl,
@@ -106,11 +110,15 @@ impl AnalysisHost {
106 imp: AnalysisHostImpl::new(), 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 pub fn analysis(&self) -> Analysis { 115 pub fn analysis(&self) -> Analysis {
110 Analysis { 116 Analysis {
111 imp: self.imp.analysis(), 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 pub fn apply_change(&mut self, change: AnalysisChange) { 122 pub fn apply_change(&mut self, change: AnalysisChange) {
115 self.imp.apply_change(change) 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#[derive(Debug)] 206#[derive(Debug)]
195pub struct Analysis { 207pub struct Analysis {
196 pub(crate) imp: AnalysisImpl, 208 pub(crate) imp: AnalysisImpl,