pub struct ImportMap {
item_to_info_map: IndexMap<ItemInNs, (SmallVec<[ImportInfo; 1]>, IsTraitAssocItem), FxBuildHasher>,
importables: Vec<(ItemInNs, u32)>,
fst: Map<Vec<u8>>,
}Expand description
A map from publicly exported items to its name.
Reexports of items are taken into account.
Fields§
§item_to_info_map: IndexMap<ItemInNs, (SmallVec<[ImportInfo; 1]>, IsTraitAssocItem), FxBuildHasher>Maps from ItemInNs to information of imports that bring the item into scope.
importables: Vec<(ItemInNs, u32)>List of keys stored in Self::item_to_info_map, sorted lexicographically by their
[Name]. Indexed by the values returned by running fst.
Since a name can refer to multiple items due to namespacing and import aliases, we store all items with the same name right after each other. This allows us to find all items after the fst gives us the index of the first one.
The u32 is the index into the smallvec in the value of Self::item_to_info_map.
fst: Map<Vec<u8>>Implementations§
Source§impl ImportMap
impl ImportMap
pub fn dump(&self, db: &dyn SourceDatabase) -> String
fn import_map_query_impl(db: &dyn SourceDatabase, krate: Crate) -> Self
pub fn import_info_for(&self, item: ItemInNs) -> Option<&[ImportInfo]>
fn collect_import_map( db: &dyn SourceDatabase, krate: Crate, ) -> IndexMap<ItemInNs, (SmallVec<[ImportInfo; 1]>, IsTraitAssocItem), FxBuildHasher>
fn collect_enum_variants( db: &dyn SourceDatabase, map: &mut IndexMap<ItemInNs, (SmallVec<[ImportInfo; 1]>, IsTraitAssocItem), FxBuildHasher>, enum_: EnumId, enum_import_info: &ImportInfo, )
fn collect_trait_assoc_items( db: &dyn SourceDatabase, map: &mut IndexMap<ItemInNs, (SmallVec<[ImportInfo; 1]>, IsTraitAssocItem), FxBuildHasher>, tr: TraitId, is_type_in_ns: bool, trait_import_info: &ImportInfo, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImportMap
impl RefUnwindSafe for ImportMap
impl Send for ImportMap
impl Sync for ImportMap
impl Unpin for ImportMap
impl UnsafeUnpin for ImportMap
impl UnwindSafe for ImportMap
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more