Skip to main content

AstId

Type Alias AstId 

Source
pub type AstId<N> = InFile<FileAstId<N>>;
Expand description

AstId points to an AST node in any file.

It is stable across reparses, and can be used as salsa key/value.

Aliased Type§

pub struct AstId<N> {
    pub file_id: HirFileId,
    pub value: FileAstId<N>,
}

Fields§

§file_id: HirFileId§value: FileAstId<N>

Implementations§

Source§

impl AstId<Macro>

Source

pub fn decl_macro_expander<'db>( self: AstId<Macro>, db: &'db dyn SourceDatabase, def_crate: Crate, ) -> &'db DeclarativeMacroExpander

Fetches (and compiles) the expander of this decl macro.

Source§

impl<N: AstNode> AstId<N>

Source

pub fn to_node(&self, db: &dyn SourceDatabase) -> N

Source

pub fn to_range(&self, db: &dyn SourceDatabase) -> TextRange

Source

pub fn to_in_file_node(&self, db: &dyn SourceDatabase) -> InFile<N>

Source

pub fn to_ptr(&self, db: &dyn SourceDatabase) -> AstPtr<N>

Source

pub fn erase(&self) -> ErasedAstId

Source

pub fn upcast<M: AstIdNode>(self) -> AstId<M>
where N: Into<M>,