pub trait HasSource {
type Ast;
// Required method
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>;
}
Required Associated Types§
Required Methods§
sourcefn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>
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