hir

Trait 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