Struct ra_ap_hir::InFile [−][src]
pub struct InFile<T> {
pub file_id: HirFileId,
pub value: T,
}
Expand description
InFile<T>
stores a value of T
inside a particular file/syntax tree.
Typical usages are:
InFile<SyntaxNode>
– syntax node in a fileInFile<ast::FnDef>
– ast node in a fileInFile<TextSize>
– offset in a file
Fields
file_id: HirFileId
value: T
Implementations
pub fn ancestors_with_macros(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode<RustLanguage>>> + Clone
pub fn ancestors_with_macros_skip_attr_item(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode<RustLanguage>>>
pub fn ancestors_with_macros_skip_attr_item(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode<RustLanguage>>>
Skips the attributed item that caused the macro invocation we are climbing up
Falls back to the macro call range if the node cannot be mapped up fully.
Attempts to map the syntax node back up its macro calls.
pub fn ancestors_with_macros(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode<RustLanguage>>>
pub fn nodes_with_attributes<'db>(
self,
db: &'db (dyn AstDatabase + 'db)
) -> impl Iterator<Item = InFile<N>> + 'db where
N: 'db,
Trait Implementations
pub fn as_call_id_with_errors(
&self,
db: &dyn DefDatabase,
krate: CrateId,
resolver: impl Fn(ModPath) -> Option<MacroDefId>,
error_sink: &mut dyn FnMut(ExpandError)
) -> Result<Result<MacroCallId, ErrorEmitted>, UnresolvedMacro>
fn as_call_id(
&self,
db: &dyn DefDatabase,
krate: CrateId,
resolver: impl Fn(ModPath) -> Option<MacroDefId>
) -> Option<MacroCallId>
Auto Trait Implementations
impl<T> RefUnwindSafe for InFile<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for InFile<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more