Struct ra_ap_hir::Semantics [−][src]
pub struct Semantics<'db, DB> { pub db: &'db DB, // some fields omitted }
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.
pub fn speculative_expand(
&self,
actual_macro_call: &MacroCall,
speculative_args: &TokenTree,
token_to_map: SyntaxToken
) -> Option<(SyntaxNode, SyntaxToken)>
pub fn descend_node_at_offset<N: AstNode>(
&self,
node: &SyntaxNode,
offset: TextSize
) -> Option<N>
pub fn token_ancestors_with_macros(
&self,
token: SyntaxToken
) -> impl Iterator<Item = SyntaxNode> + '_
pub fn ancestors_with_macros(
&self,
node: SyntaxNode
) -> impl Iterator<Item = SyntaxNode> + '_
pub fn ancestors_at_offset_with_macros(
&self,
node: &SyntaxNode,
offset: TextSize
) -> impl Iterator<Item = SyntaxNode> + '_
pub fn find_node_at_offset_with_macros<N: AstNode>(
&self,
node: &SyntaxNode,
offset: TextSize
) -> Option<N>
pub fn find_node_at_offset_with_macros<N: AstNode>(
&self,
node: &SyntaxNode,
offset: TextSize
) -> Option<N>
Find a AstNode by offset inside SyntaxNode, if it is inside Macrofile, search up until it is of the target AstNode type
pub fn find_node_at_offset_with_descend<N: AstNode>(
&self,
node: &SyntaxNode,
offset: TextSize
) -> Option<N>
pub fn find_node_at_offset_with_descend<N: AstNode>(
&self,
node: &SyntaxNode,
offset: TextSize
) -> Option<N>
Find a AstNode by offset inside SyntaxNode, if it is inside MacroCall, descend it and find again
pub fn resolve_record_field(
&self,
field: &RecordExprField
) -> Option<(Field, Option<Local>, Type)>
Trait Implementations
Auto Trait Implementations
impl<'db, DB> !RefUnwindSafe for Semantics<'db, DB>
impl<'db, DB> !UnwindSafe for Semantics<'db, DB>
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
impl<T> Any for T where
T: Any,