mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Some docs
This commit is contained in:
parent
f6f9a0bf35
commit
962a491829
1 changed files with 12 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
//! ra_analyzer crate is the brain of Rust analyzer. It relies on the `salsa`
|
||||||
|
//! crate, which provides and incremental on-deman database of facts.
|
||||||
|
|
||||||
extern crate fst;
|
extern crate fst;
|
||||||
extern crate ra_editor;
|
extern crate ra_editor;
|
||||||
extern crate ra_syntax;
|
extern crate ra_syntax;
|
||||||
|
@ -95,6 +98,7 @@ impl AnalysisChange {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `AnalysisHost` stores the current state of the world.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AnalysisHost {
|
pub struct AnalysisHost {
|
||||||
imp: AnalysisHostImpl,
|
imp: AnalysisHostImpl,
|
||||||
|
@ -106,11 +110,15 @@ impl AnalysisHost {
|
||||||
imp: AnalysisHostImpl::new(),
|
imp: AnalysisHostImpl::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// Returns a snapshot of the current state, which you can query for
|
||||||
|
/// semantic information.
|
||||||
pub fn analysis(&self) -> Analysis {
|
pub fn analysis(&self) -> Analysis {
|
||||||
Analysis {
|
Analysis {
|
||||||
imp: self.imp.analysis(),
|
imp: self.imp.analysis(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// Applies changes to the current state of the world. If there are
|
||||||
|
/// outstanding snapshots, they will be canceled.
|
||||||
pub fn apply_change(&mut self, change: AnalysisChange) {
|
pub fn apply_change(&mut self, change: AnalysisChange) {
|
||||||
self.imp.apply_change(change)
|
self.imp.apply_change(change)
|
||||||
}
|
}
|
||||||
|
@ -191,6 +199,10 @@ impl Query {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Analysis is a snapshot of a world state at a moment in time. It is the main
|
||||||
|
/// entry point for asking semantic information about the world. When the world
|
||||||
|
/// state is advanced using `AnalysisHost::apply_change` method, all existing
|
||||||
|
/// `Analysis` are canceled (most method return `Err(Canceled)`).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Analysis {
|
pub struct Analysis {
|
||||||
pub(crate) imp: AnalysisImpl,
|
pub(crate) imp: AnalysisImpl,
|
||||||
|
|
Loading…
Reference in a new issue