pub struct ModuleData {
pub origin: ModuleOrigin,
pub visibility: Visibility,
pub parent: Option<LocalModuleId>,
pub children: IndexMap<Name, LocalModuleId, BuildHasherDefault<FxHasher>>,
pub scope: ItemScope,
}
Fields§
§origin: ModuleOrigin
Where does this module come from?
visibility: Visibility
Declared visibility of this module.
parent: Option<LocalModuleId>
Parent module in the same DefMap
.
None
for block modules because they are always its DefMap
’s root.
children: IndexMap<Name, LocalModuleId, BuildHasherDefault<FxHasher>>
§scope: ItemScope
Implementations§
source§impl ModuleData
impl ModuleData
sourcepub fn definition_source(&self, db: &dyn DefDatabase) -> InFile<ModuleSource>
pub fn definition_source(&self, db: &dyn DefDatabase) -> InFile<ModuleSource>
Returns a node which defines this module. That is, a file or a mod foo {}
with items.
sourcepub fn definition_source_file_id(&self) -> HirFileId
pub fn definition_source_file_id(&self) -> HirFileId
Same as [definition_source
] but only returns the file id to prevent parsing the ASt.
pub fn definition_source_range(&self, db: &dyn DefDatabase) -> InFile<TextRange>
sourcepub fn declaration_source(&self, db: &dyn DefDatabase) -> Option<InFile<Module>>
pub fn declaration_source(&self, db: &dyn DefDatabase) -> Option<InFile<Module>>
Returns a node which declares this module, either a mod foo;
or a mod foo {}
.
None
for the crate root or block.
sourcepub fn declaration_source_range(
&self,
db: &dyn DefDatabase,
) -> Option<InFile<TextRange>>
pub fn declaration_source_range( &self, db: &dyn DefDatabase, ) -> Option<InFile<TextRange>>
Returns the range which declares this module, either a mod foo;
or a mod foo {}
.
None
for the crate root or block.
Trait Implementations§
source§impl Debug for ModuleData
impl Debug for ModuleData
source§impl PartialEq for ModuleData
impl PartialEq for ModuleData
impl Eq for ModuleData
impl StructuralPartialEq for ModuleData
Auto Trait Implementations§
impl Freeze for ModuleData
impl RefUnwindSafe for ModuleData
impl Send for ModuleData
impl Sync for ModuleData
impl Unpin for ModuleData
impl UnwindSafe for ModuleData
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
Checks if this value is equivalent to the given key. 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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