[][src]Struct ra_ap_ide::Semantics

pub struct Semantics<'db, DB> {
    pub db: &'db DB,
    // some fields omitted
}

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

Fields

db: &'db DB

Implementations

impl<'db, DB> Semantics<'db, DB> where
    DB: HirDatabase, 
[src]

pub fn new(db: &DB) -> Semantics<'_, DB>[src]

pub fn parse(&self, file_id: FileId) -> SourceFile[src]

pub fn expand(&self, macro_call: &MacroCall) -> Option<SyntaxNode<RustLanguage>>[src]

pub fn speculative_expand(
    &self,
    actual_macro_call: &MacroCall,
    hypothetical_args: &TokenTree,
    token_to_map: SyntaxToken<RustLanguage>
) -> Option<(SyntaxNode<RustLanguage>, SyntaxToken<RustLanguage>)>
[src]

pub fn descend_into_macros(
    &self,
    token: SyntaxToken<RustLanguage>
) -> SyntaxToken<RustLanguage>
[src]

pub fn descend_node_at_offset<N>(
    &self,
    node: &SyntaxNode<RustLanguage>,
    offset: TextSize
) -> Option<N> where
    N: AstNode
[src]

pub fn original_range(&self, node: &SyntaxNode<RustLanguage>) -> FileRange[src]

pub fn diagnostics_display_range(
    &self,
    diagnostics: &(dyn Diagnostic + 'static)
) -> FileRange
[src]

pub fn ancestors_with_macros(
    &self,
    node: SyntaxNode<RustLanguage>
) -> impl Iterator<Item = SyntaxNode<RustLanguage>>
[src]

pub fn ancestors_at_offset_with_macros(
    &self,
    node: &SyntaxNode<RustLanguage>,
    offset: TextSize
) -> impl Iterator<Item = SyntaxNode<RustLanguage>>
[src]

pub fn find_node_at_offset_with_macros<N>(
    &self,
    node: &SyntaxNode<RustLanguage>,
    offset: TextSize
) -> Option<N> where
    N: AstNode
[src]

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>(
    &self,
    node: &SyntaxNode<RustLanguage>,
    offset: TextSize
) -> Option<N> where
    N: AstNode
[src]

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

pub fn type_of_expr(&self, expr: &Expr) -> Option<Type>[src]

pub fn type_of_pat(&self, pat: &Pat) -> Option<Type>[src]

pub fn type_of_self(&self, param: &SelfParam) -> Option<Type>[src]

pub fn resolve_method_call(&self, call: &MethodCallExpr) -> Option<Function>[src]

pub fn resolve_method_call_as_callable(
    &self,
    call: &MethodCallExpr
) -> Option<Callable>
[src]

pub fn resolve_field(&self, field: &FieldExpr) -> Option<Field>[src]

pub fn resolve_record_field(
    &self,
    field: &RecordExprField
) -> Option<(Field, Option<Local>)>
[src]

pub fn resolve_record_pat_field(&self, field: &RecordPatField) -> Option<Field>[src]

pub fn resolve_macro_call(&self, macro_call: &MacroCall) -> Option<MacroDef>[src]

pub fn resolve_path(&self, path: &Path) -> Option<PathResolution>[src]

pub fn resolve_extern_crate(&self, extern_crate: &ExternCrate) -> Option<Crate>[src]

pub fn resolve_variant(&self, record_lit: RecordExpr) -> Option<VariantDef>[src]

pub fn resolve_bind_pat_to_const(&self, pat: &IdentPat) -> Option<ModuleDef>[src]

pub fn record_literal_missing_fields(
    &self,
    literal: &RecordExpr
) -> Vec<(Field, Type), Global>
[src]

pub fn record_pattern_missing_fields(
    &self,
    pattern: &RecordPat
) -> Vec<(Field, Type), Global>
[src]

pub fn to_def<T>(&self, src: &T) -> Option<<T as ToDef>::Def> where
    T: ToDef, 
[src]

pub fn to_module_def(&self, file: FileId) -> Option<Module>[src]

pub fn scope(&self, node: &SyntaxNode<RustLanguage>) -> SemanticsScope<'db>[src]

pub fn scope_at_offset(
    &self,
    node: &SyntaxNode<RustLanguage>,
    offset: TextSize
) -> SemanticsScope<'db>
[src]

pub fn scope_for_def(&self, def: Trait) -> SemanticsScope<'db>[src]

pub fn assert_contains_node(&self, node: &SyntaxNode<RustLanguage>)[src]

pub fn is_unsafe_method_call(&self, method_call_expr: &MethodCallExpr) -> bool[src]

pub fn is_unsafe_ref_expr(&self, ref_expr: &RefExpr) -> bool[src]

pub fn is_unsafe_ident_pat(&self, ident_pat: &IdentPat) -> bool[src]

Trait Implementations

impl<'_, DB> Debug for Semantics<'_, DB>[src]

Auto Trait Implementations

impl<'db, DB> !RefUnwindSafe for Semantics<'db, DB>

impl<'db, DB> !Send for Semantics<'db, DB>

impl<'db, DB> !Sync for Semantics<'db, DB>

impl<'db, DB> Unpin for Semantics<'db, DB>

impl<'db, DB> !UnwindSafe for Semantics<'db, DB>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Cast for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.