Skip to main content

Index

Struct Index 

Source
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

Source

pub fn record(&mut self, span: Span, role: Role, target: Target)

Record an occurrence, unless the same one is already recorded.

Source

pub fn mark_shorthand(&mut self, span: Span)

Mark every occurrence at span as a shorthand field’s.

Source

pub fn has(&self, span: Span, role: Role, target: Target) -> bool

Source

pub fn implement(&mut self, method: DefId, trait_method: (DefId, u32))

Record that method, an impl’s, implements trait_method.

Source

pub fn extend(&mut self, occurrences: impl IntoIterator<Item = Occurrence>)

Record each of occurrences, as Index::record does.

Source

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.

Source

pub fn of(&self, target: &Target) -> Vec<&Occurrence>

Every occurrence of target, in recording order.

Source

pub fn declaration(&self, target: &Target) -> Option<&Occurrence>

Source

pub fn family(&self, target: &Target) -> Vec<Target>

target’s family (spec §3.1): a trait method and the impl methods that implement it, the trait’s first; any other target alone.

Trait Implementations§

Source§

impl Clone for Index

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Index

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Index

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.