Trait hir::db::DefDatabase[][src]

pub trait DefDatabase: Database + HasQueryGroup<DefDatabaseStorage> + InternDatabase + AstDatabase + Upcast<dyn AstDatabase + 'static> {
Show 30 methods fn enable_proc_attr_macros(&self) -> bool;
fn set_enable_proc_attr_macros(&mut self, value__: bool);
fn set_enable_proc_attr_macros_with_durability(
        &mut self,
        value__: bool,
        durability__: Durability
    );
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;
fn crate_def_map(&self, krate: CrateId) -> Arc<DefMap>;
fn crate_def_map_query(&self, krate: CrateId) -> Arc<DefMap>;
fn block_def_map(&self, block: BlockId) -> Option<Arc<DefMap>>;
fn struct_data(&self, id: StructId) -> Arc<StructData>;
fn union_data(&self, id: UnionId) -> Arc<StructData>;
fn enum_data(&self, e: EnumId) -> Arc<EnumData>;
fn impl_data(&self, e: ImplId) -> Arc<ImplData>;
fn trait_data(&self, e: TraitId) -> Arc<TraitData>;
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, konst: StaticId) -> Arc<StaticData>;
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) -> Interned<GenericParams>;
fn variants_attrs(
        &self,
        def: EnumId
    ) -> Arc<ArenaMap<Idx<EnumVariantData>, Attrs>>;
fn fields_attrs(
        &self,
        def: VariantId
    ) -> Arc<ArenaMap<Idx<FieldData>, Attrs>>;
fn variants_attrs_source_map(
        &self,
        def: EnumId
    ) -> Arc<ArenaMap<Idx<EnumVariantData>, AstPtr<Variant>>>;
fn fields_attrs_source_map(
        &self,
        def: VariantId
    ) -> Arc<ArenaMap<Idx<FieldData>, Either<AstPtr<TupleField>, AstPtr<RecordField>>>>;
fn attrs(&self, def: AttrDefId) -> AttrsWithOwner;
fn crate_lang_items(&self, krate: CrateId) -> Arc<LangItems>;
fn lang_item(
        &self,
        start_crate: CrateId,
        item: SmolStr
    ) -> Option<LangItemTarget>;
fn import_map(&self, krate: CrateId) -> Arc<ImportMap>;
fn field_visibilities(
        &self,
        var: VariantId
    ) -> Arc<ArenaMap<Idx<FieldData>, Visibility>>;
fn function_visibility(&self, def: FunctionId) -> Visibility;
}

Required methods

Set the value of the enable_proc_attr_macros input.

See enable_proc_attr_macros for details.

Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.

Set the value of the enable_proc_attr_macros input and promise that its value will never change again.

See enable_proc_attr_macros for details.

Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.

Computes the block-level DefMap, returning None when block doesn’t contain any inner items directly.

For example:

fn f() { // (0)
    { // (1)
        fn inner() {}
    }
}

The block_def_map for block 0 would return None, while block_def_map of block 1 would return a DefMap containing inner.

Implementors