aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r--crates/ra_analysis/src/lib.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index b1d5c4936..988a45b46 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -42,6 +42,15 @@ pub struct Cancel;
42 42
43pub type Cancelable<T> = Result<T, Cancel>; 43pub type Cancelable<T> = Result<T, Cancel>;
44 44
45impl std::fmt::Display for Cancel {
46 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 fmt.write_str("Canceled")
48 }
49}
50
51impl std::error::Error for Cancel {
52}
53
45#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 54#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
46pub struct FileId(pub u32); 55pub struct FileId(pub u32);
47 56
@@ -225,7 +234,7 @@ impl Analysis {
225 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, token: &JobToken) -> Vec<(FileId, TextRange)> { 234 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, token: &JobToken) -> Vec<(FileId, TextRange)> {
226 self.imp.find_all_refs(file_id, offset, token) 235 self.imp.find_all_refs(file_id, offset, token)
227 } 236 }
228 pub fn parent_module(&self, file_id: FileId) -> Vec<(FileId, FileSymbol)> { 237 pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> {
229 self.imp.parent_module(file_id) 238 self.imp.parent_module(file_id)
230 } 239 }
231 pub fn crate_for(&self, file_id: FileId) -> Vec<CrateId> { 240 pub fn crate_for(&self, file_id: FileId) -> Vec<CrateId> {