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]
impl HirFileId
[src]pub fn original_file(self, db: &dyn AstDatabase) -> FileId
[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]
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]
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]
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]
pub fn is_include_macro(&self, db: &dyn AstDatabase) -> bool
[src]Return whether this file is an include macro
Trait Implementations
impl Copy for HirFileId
[src]
impl Eq for HirFileId
[src]
impl StructuralEq for HirFileId
[src]
impl StructuralPartialEq for HirFileId
[src]
Auto Trait Implementations
impl RefUnwindSafe for HirFileId
impl Send for HirFileId
impl Sync for HirFileId
impl Unpin for HirFileId
impl UnwindSafe for HirFileId
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[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]
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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