pub struct ModuleId {
pub local_id: LocalModuleId,
/* private fields */
}
Fields§
§local_id: LocalModuleId
The module’s ID in its originating DefMap
.
Implementations§
source§impl ModuleId
impl ModuleId
pub fn def_map(self, db: &dyn DefDatabase) -> Arc<DefMap>
pub fn crate_def_map(self, db: &dyn DefDatabase) -> Arc<DefMap>
pub fn krate(self) -> CrateId
pub fn name(self, db: &dyn DefDatabase) -> Option<Name>
sourcepub fn containing_module(self, db: &dyn DefDatabase) -> Option<ModuleId>
pub fn containing_module(self, db: &dyn DefDatabase) -> Option<ModuleId>
Returns the module containing self
, either the parent mod
, or the module (or block) containing
the block, if self
corresponds to a block expression.
pub fn containing_block(self) -> Option<BlockId>
pub fn is_block_module(self) -> bool
pub fn is_within_block(self) -> bool
sourcepub fn as_crate_root(&self) -> Option<CrateRootModuleId>
pub fn as_crate_root(&self) -> Option<CrateRootModuleId>
Returns the CrateRootModuleId
for this module if it is the crate root module.
sourcepub fn derive_crate_root(&self) -> CrateRootModuleId
pub fn derive_crate_root(&self) -> CrateRootModuleId
Returns the CrateRootModuleId
for this module.
Trait Implementations§
source§impl From<CrateRootModuleId> for ModuleId
impl From<CrateRootModuleId> for ModuleId
source§fn from(_: CrateRootModuleId) -> Self
fn from(_: CrateRootModuleId) -> Self
Converts to this type from the input type.
source§impl From<ModuleId> for ItemContainerId
impl From<ModuleId> for ItemContainerId
source§fn from(it: ModuleId) -> ItemContainerId
fn from(it: ModuleId) -> ItemContainerId
Converts to this type from the input type.
source§impl From<ModuleId> for ModuleDefId
impl From<ModuleId> for ModuleDefId
source§fn from(it: ModuleId) -> ModuleDefId
fn from(it: ModuleId) -> ModuleDefId
Converts to this type from the input type.
source§impl HasResolver for ModuleId
impl HasResolver for ModuleId
source§fn resolver(self, db: &dyn DefDatabase) -> Resolver
fn resolver(self, db: &dyn DefDatabase) -> Resolver
Builds a resolver for type references inside this def.
source§impl Ord for ModuleId
impl Ord for ModuleId
source§impl PartialEq<CrateRootModuleId> for ModuleId
impl PartialEq<CrateRootModuleId> for ModuleId
source§impl PartialEq<ModuleId> for CrateRootModuleId
impl PartialEq<ModuleId> for CrateRootModuleId
source§impl PartialOrd for ModuleId
impl PartialOrd for ModuleId
source§impl TryFrom<ModuleId> for CrateRootModuleId
impl TryFrom<ModuleId> for CrateRootModuleId
impl Copy for ModuleId
impl Eq for ModuleId
impl StructuralPartialEq for ModuleId
Auto Trait Implementations§
impl Freeze for ModuleId
impl RefUnwindSafe for ModuleId
impl Send for ModuleId
impl Sync for ModuleId
impl Unpin for ModuleId
impl UnwindSafe for ModuleId
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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