[−][src]Struct ra_ap_hir_expand::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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<HirFileId> 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,