Struct ra_ap_hir_expand::HirFileId[][src]

pub struct HirFileId(_);
Expand description

Input to the analyzer is a set of files, where each file is identified by FileId and contains source code. However, another source of source code in Rust are macros: each macro can be thought of as producing a “temporary file”. To assign an id to such a file, we use the id of the macro call that produced the file. So, a HirFileId is either a FileId (source code written by user), or a MacroCallId (source code produced by macro).

What is a MacroCallId? Simplifying, it’s a HirFileId of a file containing the call plus the offset of the macro call in the file. Note that this is a recursive definition! However, the size_of of HirFileId is finite (because everything bottoms out at the real FileId) and small (MacroCallId uses the location interning. You can check details here: https://en.wikipedia.org/wiki/String_interning).

Implementations

impl HirFileId[src]

pub fn original_file(self, db: &dyn AstDatabase) -> FileId[src]

For macro-expansion files, returns the file original source file the expansion originated from.

pub fn expansion_level(self, db: &dyn AstDatabase) -> u32[src]

pub fn call_node(self, db: &dyn AstDatabase) -> Option<InFile<SyntaxNode>>[src]

If this is a macro call, returns the syntax node of the call.

pub fn expansion_info(self, db: &dyn AstDatabase) -> Option<ExpansionInfo>[src]

Return expansion information if it is a macro-expansion file

pub fn is_builtin_derive(&self, db: &dyn AstDatabase) -> Option<InFile<Item>>[src]

Indicate it is macro file generated for builtin derive

pub fn is_include_macro(&self, db: &dyn AstDatabase) -> bool[src]

Return whether this file is an include macro

Trait Implementations

impl Clone for HirFileId[src]

fn clone(&self) -> HirFileId[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for HirFileId[src]

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

Formats the value using the given formatter. Read more

impl From<FileId> for HirFileId[src]

fn from(id: FileId) -> Self[src]

Performs the conversion.

impl From<MacroFile> for HirFileId[src]

fn from(id: MacroFile) -> Self[src]

Performs the conversion.

impl Hash for HirFileId[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<HirFileId> for HirFileId[src]

fn eq(&self, other: &HirFileId) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &HirFileId) -> bool[src]

This method tests for !=.

impl Copy for HirFileId[src]

impl Eq for HirFileId[src]

impl StructuralEq for HirFileId[src]

impl StructuralPartialEq for HirFileId[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.