pub struct Index {
pub occurrences: Vec<Occurrence>,
pub implements: Vec<(DefId, (DefId, u32))>,
pub types: HashMap<Span, String>,
pub locals: HashMap<Span, LocalFlags>,
/* private fields */
}Expand description
Every name an analysis resolved (spec §3.1).
Fields§
§occurrences: Vec<Occurrence>§implements: Vec<(DefId, (DefId, u32))>Each impl method that implements a trait’s method.
types: HashMap<Span, String>Each local’s type as hover shows it, by declaration span.
locals: HashMap<Span, LocalFlags>Each local’s declaration span: whether it is a parameter and whether
it is mut (spec 3.4b §4.6, §7.2). Recorded with the index only.
Implementations§
Source§impl Index
impl Index
Sourcepub fn record(&mut self, span: Span, role: Role, target: Target)
pub fn record(&mut self, span: Span, role: Role, target: Target)
Record an occurrence, unless the same one is already recorded.
Sourcepub fn mark_shorthand(&mut self, span: Span)
pub fn mark_shorthand(&mut self, span: Span)
Mark every occurrence at span as a shorthand field’s.
pub fn has(&self, span: Span, role: Role, target: Target) -> bool
Sourcepub fn implement(&mut self, method: DefId, trait_method: (DefId, u32))
pub fn implement(&mut self, method: DefId, trait_method: (DefId, u32))
Record that method, an impl’s, implements trait_method.
Sourcepub fn extend(&mut self, occurrences: impl IntoIterator<Item = Occurrence>)
pub fn extend(&mut self, occurrences: impl IntoIterator<Item = Occurrence>)
Record each of occurrences, as Index::record does.
Sourcepub fn at(
&self,
defs: &Definitions,
file: FileId,
offset: u32,
) -> Option<&Occurrence>
pub fn at( &self, defs: &Definitions, file: FileId, offset: u32, ) -> Option<&Occurrence>
The occurrence at byte offset of file: one whose span holds it,
or else one that ends there (spec §3.1). On a shared span the
value’s wins, then the type’s, then the trait’s, then a field’s.
Sourcepub fn of(&self, target: &Target) -> Vec<&Occurrence>
pub fn of(&self, target: &Target) -> Vec<&Occurrence>
Every occurrence of target, in recording order.
pub fn declaration(&self, target: &Target) -> Option<&Occurrence>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more