Trait hir::HasSource

source ·
pub trait HasSource {
    type Ast;

    // Required method
    fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>;
}

Required Associated Types§

Required Methods§

source

fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>

Fetches the definition’s source node. Using [crate::Semantics::source] is preferred when working with crate::Semantics, as that caches the parsed file in the semantics’ cache.

The current some implementations can return InFile instead of Option<InFile>. But we made this method Option to support rlib in the future by https://github.com/rust-lang/rust-analyzer/issues/6913

Implementors§

source§

impl HasSource for Adt

source§

type Ast = Adt

source§

impl HasSource for Const

source§

type Ast = Const

source§

impl HasSource for Enum

source§

type Ast = Enum

source§

impl HasSource for ExternCrateDecl

source§

type Ast = ExternCrate

source§

impl HasSource for Field

source§

impl HasSource for Function

source§

type Ast = Fn

source§

impl HasSource for Impl

source§

type Ast = Impl

source§

impl HasSource for InlineAsmOperand

source§

type Ast = AsmOperandNamed

source§

impl HasSource for Label

source§

type Ast = Label

source§

impl HasSource for LifetimeParam

source§

type Ast = LifetimeParam

source§

impl HasSource for LocalSource

source§

type Ast = Either<IdentPat, SelfParam>

source§

impl HasSource for Macro

source§

type Ast = Either<Macro, Fn>

source§

impl HasSource for Param

source§

type Ast = Either<SelfParam, Param>

source§

impl HasSource for SelfParam

source§

type Ast = SelfParam

source§

impl HasSource for Static

source§

type Ast = Static

source§

impl HasSource for Struct

source§

type Ast = Struct

source§

impl HasSource for Trait

source§

type Ast = Trait

source§

impl HasSource for TraitAlias

source§

type Ast = TraitAlias

source§

impl HasSource for TypeAlias

source§

type Ast = TypeAlias

source§

impl HasSource for TypeOrConstParam

source§

type Ast = Either<TypeOrConstParam, TraitOrAlias>

source§

impl HasSource for Union

source§

type Ast = Union

source§

impl HasSource for Variant

source§

type Ast = Variant