Struct rustc_resolve::ModuleData[−][src]

pub struct ModuleData<'a> {
    parent: Option<&'a ModuleData<'a>>,
    kind: ModuleKind,
    nearest_parent_mod: DefId,
    lazy_resolutions: RefCell<FxIndexMap<BindingKey, &'a RefCell<NameResolution<'a>>>>,
    populate_on_access: Cell<bool>,
    unexpanded_invocations: RefCell<FxHashSet<ExpnId>>,
    no_implicit_prelude: bool,
    glob_importers: RefCell<Vec<&'a Import<'a>>>,
    globs: RefCell<Vec<&'a Import<'a>>>,
    traits: RefCell<Option<Box<[(Ident, &'a NameBinding<'a>)]>>>,
    span: Span,
    expansion: ExpnId,
}
Expand description

One node in the tree of modules.

Note that a “module” in resolve is broader than a mod that you declare in Rust code. It may be one of these:

  • mod
  • crate root (aka, top-level anonymous module)
  • enum
  • trait
  • curly-braced block with statements

You can use ModuleData::kind to determine the kind of module this is.

Fields

parent: Option<&'a ModuleData<'a>>
Expand description

The direct parent module (it may not be a mod, however).

kind: ModuleKind
Expand description

What kind of module this is, because this may not be a mod.

nearest_parent_mod: DefId
Expand description

The DefId of the nearest mod item ancestor (which may be this module). This may be the crate root.

lazy_resolutions: RefCell<FxIndexMap<BindingKey, &'a RefCell<NameResolution<'a>>>>
Expand description

Mapping between names and their (possibly in-progress) resolutions in this module. Resolutions in modules from other crates are not populated until accessed.

populate_on_access: Cell<bool>
Expand description

True if this is a module from other crate that needs to be populated on access.

unexpanded_invocations: RefCell<FxHashSet<ExpnId>>
Expand description

Macro invocations that can expand into items in this module.

no_implicit_prelude: bool
Expand description

Whether #[no_implicit_prelude] is active.

glob_importers: RefCell<Vec<&'a Import<'a>>>globs: RefCell<Vec<&'a Import<'a>>>traits: RefCell<Option<Box<[(Ident, &'a NameBinding<'a>)]>>>
Expand description

Used to memoize the traits in this module for faster searches through all traits in scope.

span: Span
Expand description

Span of the module itself. Used for error reporting.

expansion: ExpnId

Implementations

impl<'a> ModuleData<'a>[src]

pub(crate) fn new(
    parent: Option<&'a ModuleData<'a>>,
    kind: ModuleKind,
    nearest_parent_mod: DefId,
    expansion: ExpnId,
    span: Span
) -> Self
[src]

pub(crate) fn for_each_child<R, F>(&'a self, resolver: &mut R, f: F) where
    R: AsMut<Resolver<'a>>,
    F: FnMut(&mut R, Ident, Namespace, &'a NameBinding<'a>), 
[src]

pub(crate) fn ensure_traits<R>(&'a self, resolver: &mut R) where
    R: AsMut<Resolver<'a>>, 
[src]

This modifies self in place. The traits will be stored in self.traits.

pub(crate) fn res(&self) -> Option<Res<NodeId>>[src]

pub(crate) fn def_id(&self) -> Option<DefId>[src]

pub(crate) fn is_normal(&self) -> bool[src]

pub(crate) fn is_trait(&self) -> bool[src]

pub(crate) fn nearest_item_scope(&'a self) -> &'a ModuleData<'a>[src]

pub(crate) fn is_ancestor_of(&self, other: &Self) -> bool[src]

Trait Implementations

impl<'a> Debug for ModuleData<'a>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ModuleData<'a>

impl<'a> !Send for ModuleData<'a>

impl<'a> !Sync for ModuleData<'a>

impl<'a> Unpin for ModuleData<'a>

impl<'a> !UnwindSafe for ModuleData<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.