Struct ra_ap_hir_expand::InFile
source · [−]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
sourceimpl<T> InFile<T>
impl<T> InFile<T>
pub fn new(file_id: HirFileId, value: T) -> InFile<T>
pub fn with_value<U>(&self, value: U) -> InFile<U>
pub fn map<F: FnOnce(T) -> U, U>(self, f: F) -> InFile<U>
pub fn as_ref(&self) -> InFile<&T>
pub fn file_syntax(&self, db: &dyn AstDatabase) -> SyntaxNode
sourceimpl<'a> InFile<&'a SyntaxNode>
impl<'a> InFile<&'a SyntaxNode>
pub fn ancestors_with_macros(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode>> + Clone + '_
sourcepub fn ancestors_with_macros_skip_attr_item(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_
pub fn ancestors_with_macros_skip_attr_item(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_
Skips the attributed item that caused the macro invocation we are climbing up
sourcepub fn original_file_range(self, db: &dyn AstDatabase) -> FileRange
pub fn original_file_range(self, db: &dyn AstDatabase) -> FileRange
Falls back to the macro call range if the node cannot be mapped up fully.
sourcepub fn original_file_range_opt(self, db: &dyn AstDatabase) -> Option<FileRange>
pub fn original_file_range_opt(self, db: &dyn AstDatabase) -> Option<FileRange>
Attempts to map the syntax node back up its macro calls.
sourceimpl InFile<SyntaxToken>
impl InFile<SyntaxToken>
pub fn upmap(self, db: &dyn AstDatabase) -> Option<InFile<SyntaxToken>>
sourceimpl InFile<SyntaxToken>
impl InFile<SyntaxToken>
pub fn ancestors_with_macros(
self,
db: &dyn AstDatabase
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_
sourceimpl<N: AstNode> InFile<N>
impl<N: AstNode> InFile<N>
pub fn descendants<T: AstNode>(self) -> impl Iterator<Item = InFile<T>>
pub fn original_ast_node(self, db: &dyn AstDatabase) -> Option<InFile<N>>
pub fn syntax(&self) -> InFile<&SyntaxNode>
Trait Implementations
impl<T: Copy> Copy for InFile<T>
impl<T: Eq> Eq for InFile<T>
impl<T> StructuralEq for InFile<T>
impl<T> StructuralPartialEq for InFile<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for InFile<T> where
T: RefUnwindSafe,
impl<T> Send for InFile<T> where
T: Send,
impl<T> Sync for InFile<T> where
T: Sync,
impl<T> Unpin for InFile<T> where
T: Unpin,
impl<T> UnwindSafe for InFile<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more