[][src]Struct ra_ap_hir_expand::HirFileId

pub struct HirFileId(_);

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

Trait Implementations

impl Clone for HirFileId[src]

impl Copy for HirFileId[src]

impl Debug for HirFileId[src]

impl Eq for HirFileId[src]

impl From<FileId> for HirFileId[src]

impl From<MacroFile> for HirFileId[src]

impl Hash for HirFileId[src]

impl PartialEq<HirFileId> 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]

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.