]> git.lizzy.rs Git - rust.git/blob - crates/ra_hir/src/lib.rs
Merge #427
[rust.git] / crates / ra_hir / src / lib.rs
1 //! HIR (previsouly known as descriptors) provides a high-level OO acess to Rust
2 //! code.
3 //!
4 //! The principal difference between HIR and syntax trees is that HIR is bound
5 //! to a particular crate instance. That is, it has cfg flags and features
6 //! applied. So, there relation between syntax and HIR is many-to-one.
7
8 macro_rules! ctry {
9     ($expr:expr) => {
10         match $expr {
11             None => return Ok(None),
12             Some(it) => it,
13         }
14     };
15 }
16
17 pub mod db;
18 #[cfg(test)]
19 mod mock;
20 mod query_definitions;
21 mod path;
22 pub mod source_binder;
23
24 mod ids;
25 mod macros;
26 mod name;
27 // can't use `crate` or `r#crate` here :(
28 mod krate;
29 mod module;
30 mod function;
31 mod adt;
32 mod type_ref;
33 mod ty;
34 mod impl_block;
35
36 use crate::{
37     db::HirDatabase,
38     name::{AsName, KnownName},
39     ids::{DefKind, SourceItemId, SourceFileItemId, SourceFileItems},
40 };
41
42 pub use self::{
43     path::{Path, PathKind},
44     name::Name,
45     krate::Crate,
46     ids::{HirFileId, DefId, DefLoc, MacroCallId, MacroCallLoc},
47     macros::{MacroDef, MacroInput, MacroExpansion},
48     module::{Module, ModuleId, Problem, nameres::{ItemMap, PerNs, Namespace}, ModuleScope, Resolution},
49     function::{Function, FnScopes},
50     adt::{Struct, Enum},
51     ty::Ty,
52     impl_block::{ImplBlock, ImplItem},
53 };
54
55 pub use self::function::FnSignatureInfo;
56
57 pub enum Def {
58     Module(Module),
59     Function(Function),
60     Struct(Struct),
61     Enum(Enum),
62     Item,
63 }