Struct ra_ap_hir::Semantics

source ·
pub struct Semantics<'db, DB> {
    pub db: &'db DB,
    /* private fields */
}
Expand description

Primary API to get semantic information, like types, from syntax trees.

Fields§

§db: &'db DB

Implementations§

If item has an attribute macro attached to it, expands it.

Descend the token into macrocalls to its first mapped counterpart.

Descend the token into macrocalls to all its mapped counterparts.

Descend the token into macrocalls to all its mapped counterparts that have the same text as the input token.

Returns the original non descended token if none of the mapped counterparts have the same text.

Maps a node down by mapping its first and last token down.

Search for a definition’s source and cache its syntax tree

Attempts to map the node out of macro expanded files returning the original file range. If upmapping is not possible, this will fall back to the range of the macro call of the macro file the node resides in.

Attempts to map the node out of macro expanded files returning the original file range.

Attempts to map the node out of macro expanded files. This only work for attribute expansions, as other ones do not have nodes as input.

Attempts to map the node out of macro expanded files. This only work for attribute expansions, as other ones do not have nodes as input.

Iterates the ancestors of the given node, climbing up macro expansions while doing so.

Find an AstNode by offset inside SyntaxNode, if it is inside Macrofile, search up until it is of the target AstNode type

Find an AstNode by offset inside SyntaxNode, if it is inside MacroCall, descend it and find again

Find an AstNode by offset inside SyntaxNode, if it is inside MacroCall, descend it and find again

Returns true if the node is inside an unsafe context.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Cast a value to type U using CastTo.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more