Struct ra_ap_ide::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§

source§

impl<'db, DB> Semantics<'db, DB>where DB: HirDatabase,

source

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

source

pub fn hir_file_for(&self, syntax_node: &SyntaxNode<RustLanguage>) -> HirFileId

source

pub fn token_ancestors_with_macros( &self, token: SyntaxToken<RustLanguage> ) -> impl Iterator<Item = SyntaxNode<RustLanguage>>

source

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

source

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

source

pub fn find_nodes_at_offset_with_descend<'slf, N>( &'slf self, node: &SyntaxNode<RustLanguage>, offset: TextSize ) -> impl Iterator<Item = N> + 'slfwhere N: AstNode + 'slf,

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

source

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

source

pub fn resolve_method_call_field_fallback( &self, call: &MethodCallExpr ) -> Option<Either<Function, Field>>

Attempts to resolve this call expression as a method call falling back to resolving it as a field.

source

pub fn resolve_await_to_poll(&self, await_expr: &AwaitExpr) -> Option<Function>

source

pub fn resolve_prefix_expr(&self, prefix_expr: &PrefixExpr) -> Option<Function>

source

pub fn resolve_index_expr(&self, index_expr: &IndexExpr) -> Option<Function>

source

pub fn resolve_bin_expr(&self, bin_expr: &BinExpr) -> Option<Function>

source

pub fn resolve_try_expr(&self, try_expr: &TryExpr) -> Option<Function>

source

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

source

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

source

pub fn to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module>

Trait Implementations§

source§

impl<DB> Debug for Semantics<'_, DB>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

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

§

type Target = SemanticsImpl<'db>

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Semantics<'db, DB> as Deref>::Target

Dereferences the value.

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Cast for T

§

fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere Self: CastTo<U>, U: HasInterner,

Cast a value to type U using CastTo.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoBox<dyn Any> for Twhere T: Any,

source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more