Skip to main content

Index

Struct Index 

Source
pub(crate) struct Index {
    symbols: Vec<Symbol>,
    occurrences: Vec<Occurrence>,
}

Fields§

§symbols: Vec<Symbol>§occurrences: Vec<Occurrence>

Sorted by file, then position. Names never overlap, so within a file this is also sorted by end.

Implementations§

Source§

impl Index

Source

pub(crate) fn new(files: &[&File]) -> Self

Indexes files as one program, which share their top-level names.

Source

pub(crate) fn symbol(&self, id: SymbolId) -> &Symbol

Source

pub(crate) fn occurrences_in(&self, file: FileId) -> &[Occurrence]

The names in file, in source order.

Source

pub(crate) fn occurrence_at( &self, file: FileId, offset: usize, ) -> Option<Occurrence>

The name covering offset in file, including a cursor sitting just past its last character.

Source

pub(crate) fn occurrences_of( &self, id: SymbolId, ) -> impl Iterator<Item = Occurrence>

The declaration and every reference of id, file by file in source order.

Source

pub(crate) fn in_scope( &self, file: FileId, offset: usize, ) -> impl Iterator<Item = &Symbol>

The symbols whose names can be used at offset in file. Fields are only reached through a value or an argument label, so they are never in scope by themselves.

Source

pub(crate) fn declaration_of(&self, id: SymbolId) -> Option<Span>

Trait Implementations§

Source§

impl Debug for Index

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.