Struct ra_ap_ide::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 expand_derive_macro(
&self,
derive: &Attr
) -> Option<Vec<SyntaxNode<RustLanguage>, Global>>
pub fn speculative_expand(
&self,
actual_macro_call: &MacroCall,
speculative_args: &TokenTree,
token_to_map: SyntaxToken<RustLanguage>
) -> Option<(SyntaxNode<RustLanguage>, SyntaxToken<RustLanguage>)>
pub fn speculative_expand_attr_macro(
&self,
actual_macro_call: &Item,
speculative_args: &Item,
token_to_map: SyntaxToken<RustLanguage>
) -> Option<(SyntaxNode<RustLanguage>, SyntaxToken<RustLanguage>)>
pub fn descend_into_macros(
&self,
token: SyntaxToken<RustLanguage>
) -> SyntaxToken<RustLanguage>
pub fn descend_into_macros_many(
&self,
token: SyntaxToken<RustLanguage>
) -> SmallVec<[SyntaxToken<RustLanguage>; 1]>
Maps a node down by mapping its first and last token down.
Search for a definition’s source and cache its syntax tree
pub fn token_ancestors_with_macros(
&self,
token: SyntaxToken<RustLanguage>
) -> impl Iterator<Item = SyntaxNode<RustLanguage>>
pub fn ancestors_with_macros(
&self,
node: SyntaxNode<RustLanguage>
) -> impl Iterator<Item = SyntaxNode<RustLanguage>>
pub fn ancestors_at_offset_with_macros(
&self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> impl Iterator<Item = SyntaxNode<RustLanguage>>
pub fn find_node_at_offset_with_macros<N>(
&self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> Option<N> where
N: AstNode,
pub fn find_node_at_offset_with_macros<N>(
&self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> Option<N> where
N: AstNode,
Find an 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>(
&self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> Option<N> where
N: AstNode,
pub fn find_node_at_offset_with_descend<N>(
&self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> Option<N> where
N: AstNode,
Find an AstNode by offset inside SyntaxNode, if it is inside MacroCall, descend it and find again
pub fn find_nodes_at_offset_with_descend<'slf, N>(
&'slf self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> impl Iterator<Item = N> + 'slf where
N: 'slf + AstNode,
pub fn find_nodes_at_offset_with_descend<'slf, N>(
&'slf self,
node: &SyntaxNode<RustLanguage>,
offset: TextSize
) -> impl Iterator<Item = N> + 'slf where
N: 'slf + AstNode,
Find an 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)>
pub fn record_literal_missing_fields(
&self,
literal: &RecordExpr
) -> Vec<(Field, Type), Global>
pub fn scope_at_offset(
&self,
token: &SyntaxToken<RustLanguage>,
offset: TextSize
) -> SemanticsScope<'db>
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
.
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