Trait hir::db::DefDatabase
pub trait DefDatabase:
Database
+ HasQueryGroup<DefDatabaseStorage>
+ InternDatabase
+ ExpandDatabase
+ Upcast<dyn ExpandDatabase> {
Show 50 methods
// Required methods
fn expand_proc_attr_macros(&self) -> bool;
fn set_expand_proc_attr_macros(&mut self, value__: bool);
fn set_expand_proc_attr_macros_with_durability(
&mut self,
value__: bool,
durability__: Durability,
);
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;
fn block_item_tree(&self, block_id: BlockId) -> Arc<ItemTree>;
fn file_item_tree_with_source_map(
&self,
file_id: HirFileId,
) -> (Arc<ItemTree>, Arc<ItemTreeSourceMaps>);
fn block_item_tree_with_source_map(
&self,
block_id: BlockId,
) -> (Arc<ItemTree>, Arc<ItemTreeSourceMaps>);
fn crate_def_map(&self, krate: Idx<CrateData>) -> Arc<DefMap>;
fn block_def_map(&self, block: BlockId) -> Arc<DefMap>;
fn macro_def(&self, m: MacroId) -> MacroDefId;
fn struct_data(&self, id: StructId) -> Arc<StructData>;
fn struct_data_with_diagnostics(
&self,
id: StructId,
) -> (Arc<StructData>, DefDiagnostics);
fn union_data(&self, id: UnionId) -> Arc<StructData>;
fn union_data_with_diagnostics(
&self,
id: UnionId,
) -> (Arc<StructData>, DefDiagnostics);
fn enum_data(&self, e: EnumId) -> Arc<EnumData>;
fn enum_variant_data(&self, id: EnumVariantId) -> Arc<EnumVariantData>;
fn enum_variant_data_with_diagnostics(
&self,
id: EnumVariantId,
) -> (Arc<EnumVariantData>, DefDiagnostics);
fn variant_data(&self, id: VariantId) -> Arc<VariantData>;
fn impl_data(&self, e: ImplId) -> Arc<ImplData>;
fn impl_data_with_diagnostics(
&self,
e: ImplId,
) -> (Arc<ImplData>, DefDiagnostics);
fn trait_data(&self, e: TraitId) -> Arc<TraitData>;
fn trait_data_with_diagnostics(
&self,
tr: TraitId,
) -> (Arc<TraitData>, DefDiagnostics);
fn trait_alias_data(&self, e: TraitAliasId) -> Arc<TraitAliasData>;
fn type_alias_data(&self, e: TypeAliasId) -> Arc<TypeAliasData>;
fn function_data(&self, func: FunctionId) -> Arc<FunctionData>;
fn const_data(&self, konst: ConstId) -> Arc<ConstData>;
fn static_data(&self, statik: StaticId) -> Arc<StaticData>;
fn macro2_data(&self, makro: Macro2Id) -> Arc<Macro2Data>;
fn macro_rules_data(&self, makro: MacroRulesId) -> Arc<MacroRulesData>;
fn proc_macro_data(&self, makro: ProcMacroId) -> Arc<ProcMacroData>;
fn extern_crate_decl_data(
&self,
extern_crate: ExternCrateId,
) -> Arc<ExternCrateDeclData>;
fn body_with_source_map(
&self,
def: DefWithBodyId,
) -> (Arc<Body>, Arc<BodySourceMap>);
fn body(&self, def: DefWithBodyId) -> Arc<Body>;
fn expr_scopes(&self, def: DefWithBodyId) -> Arc<ExprScopes>;
fn generic_params(&self, def: GenericDefId) -> Arc<GenericParams>;
fn generic_params_with_source_map(
&self,
def: GenericDefId,
) -> (Arc<GenericParams>, Option<Arc<TypesSourceMap>>);
fn fields_attrs(
&self,
def: VariantId,
) -> Arc<ArenaMap<Idx<FieldData>, Attrs>>;
fn fields_attrs_source_map(
&self,
def: VariantId,
) -> Arc<ArenaMap<Idx<FieldData>, AstPtr<Either<TupleField, RecordField>>>>;
fn attrs(&self, def: AttrDefId) -> Attrs;
fn lang_attr(&self, def: AttrDefId) -> Option<LangItem>;
fn lang_item(
&self,
start_crate: Idx<CrateData>,
item: LangItem,
) -> Option<LangItemTarget>;
fn import_map(&self, krate: Idx<CrateData>) -> Arc<ImportMap>;
fn field_visibilities(
&self,
var: VariantId,
) -> Arc<ArenaMap<Idx<FieldData>, Visibility>>;
fn function_visibility(&self, def: FunctionId) -> Visibility;
fn const_visibility(&self, def: ConstId) -> Visibility;
fn crate_lang_items(&self, krate: Idx<CrateData>) -> Option<Arc<LangItems>>;
fn notable_traits_in_deps(
&self,
krate: Idx<CrateData>,
) -> Arc<[Arc<[TraitId]>]>;
fn crate_notable_traits(
&self,
krate: Idx<CrateData>,
) -> Option<Arc<[TraitId]>>;
fn crate_supports_no_std(&self, crate_id: Idx<CrateData>) -> bool;
fn include_macro_invoc(
&self,
crate_id: Idx<CrateData>,
) -> Arc<[(MacroCallId, EditionedFileId)]>;
}
Required Methods§
fn expand_proc_attr_macros(&self) -> bool
fn expand_proc_attr_macros(&self) -> bool
Whether to expand procedural macros during name resolution.
fn set_expand_proc_attr_macros(&mut self, value__: bool)
fn set_expand_proc_attr_macros(&mut self, value__: bool)
Set the value of the expand_proc_attr_macros
input.
See expand_proc_attr_macros
for details.
Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.
fn set_expand_proc_attr_macros_with_durability(
&mut self,
value__: bool,
durability__: Durability,
)
fn set_expand_proc_attr_macros_with_durability( &mut self, value__: bool, durability__: Durability, )
Set the value of the expand_proc_attr_macros
input with a
specific durability instead of the default of
Durability::LOW
. You can use Durability::MAX
to promise that its value will never change again.
See expand_proc_attr_macros
for details.
Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>
Computes an [ItemTree
] for the given file or macro expansion.
fn block_item_tree(&self, block_id: BlockId) -> Arc<ItemTree>
fn file_item_tree_with_source_map( &self, file_id: HirFileId, ) -> (Arc<ItemTree>, Arc<ItemTreeSourceMaps>)
fn block_item_tree_with_source_map( &self, block_id: BlockId, ) -> (Arc<ItemTree>, Arc<ItemTreeSourceMaps>)
fn crate_def_map(&self, krate: Idx<CrateData>) -> Arc<DefMap>
fn block_def_map(&self, block: BlockId) -> Arc<DefMap>
fn block_def_map(&self, block: BlockId) -> Arc<DefMap>
Computes the block-level DefMap
.
fn macro_def(&self, m: MacroId) -> MacroDefId
fn macro_def(&self, m: MacroId) -> MacroDefId
Turns a MacroId into a MacroDefId, describing the macro’s definition post name resolution.
fn struct_data(&self, id: StructId) -> Arc<StructData>
fn struct_data_with_diagnostics( &self, id: StructId, ) -> (Arc<StructData>, DefDiagnostics)
fn union_data(&self, id: UnionId) -> Arc<StructData>
fn union_data_with_diagnostics( &self, id: UnionId, ) -> (Arc<StructData>, DefDiagnostics)
fn enum_data(&self, e: EnumId) -> Arc<EnumData>
fn enum_variant_data(&self, id: EnumVariantId) -> Arc<EnumVariantData>
fn enum_variant_data_with_diagnostics( &self, id: EnumVariantId, ) -> (Arc<EnumVariantData>, DefDiagnostics)
fn variant_data(&self, id: VariantId) -> Arc<VariantData>
fn impl_data(&self, e: ImplId) -> Arc<ImplData>
fn impl_data_with_diagnostics( &self, e: ImplId, ) -> (Arc<ImplData>, DefDiagnostics)
fn trait_data(&self, e: TraitId) -> Arc<TraitData>
fn trait_data_with_diagnostics( &self, tr: TraitId, ) -> (Arc<TraitData>, DefDiagnostics)
fn trait_alias_data(&self, e: TraitAliasId) -> Arc<TraitAliasData>
fn type_alias_data(&self, e: TypeAliasId) -> Arc<TypeAliasData>
fn function_data(&self, func: FunctionId) -> Arc<FunctionData>
fn const_data(&self, konst: ConstId) -> Arc<ConstData>
fn static_data(&self, statik: StaticId) -> Arc<StaticData>
fn macro2_data(&self, makro: Macro2Id) -> Arc<Macro2Data>
fn macro_rules_data(&self, makro: MacroRulesId) -> Arc<MacroRulesData>
fn proc_macro_data(&self, makro: ProcMacroId) -> Arc<ProcMacroData>
fn extern_crate_decl_data( &self, extern_crate: ExternCrateId, ) -> Arc<ExternCrateDeclData>
fn body_with_source_map( &self, def: DefWithBodyId, ) -> (Arc<Body>, Arc<BodySourceMap>)
fn body(&self, def: DefWithBodyId) -> Arc<Body>
fn expr_scopes(&self, def: DefWithBodyId) -> Arc<ExprScopes>
fn generic_params(&self, def: GenericDefId) -> Arc<GenericParams>
fn generic_params_with_source_map(
&self,
def: GenericDefId,
) -> (Arc<GenericParams>, Option<Arc<TypesSourceMap>>)
fn generic_params_with_source_map( &self, def: GenericDefId, ) -> (Arc<GenericParams>, Option<Arc<TypesSourceMap>>)
If this returns None
for the source map, that means it is the same as with the item tree.