pub enum Module<'db> {
File(FileModule<'db>),
Namespace(NamespacePackage<'db>),
}Expand description
Representation of a Python module.
Variants§
Implementations§
Source§impl<'db> Module<'db>
impl<'db> Module<'db>
Sourcepub fn name(self, db: &'db dyn Database) -> &'db ModuleName
pub fn name(self, db: &'db dyn Database) -> &'db ModuleName
The absolute name of the module (e.g. foo.bar)
Sourcepub fn file(self, db: &'db dyn Database) -> Option<File>
pub fn file(self, db: &'db dyn Database) -> Option<File>
The file to the source code that defines this module
This is None for namespace packages.
Sourcepub fn known(self, db: &'db dyn Database) -> Option<KnownModule>
pub fn known(self, db: &'db dyn Database) -> Option<KnownModule>
Is this a module that we special-case somehow? If so, which one?
Sourcepub fn is_known(self, db: &'db dyn Database, known_module: KnownModule) -> bool
pub fn is_known(self, db: &'db dyn Database, known_module: KnownModule) -> bool
Does this module represent the given known module?
Sourcepub fn search_path(self, db: &'db dyn Database) -> Option<&'db SearchPath>
pub fn search_path(self, db: &'db dyn Database) -> Option<&'db SearchPath>
The search path from which the module was resolved.
It is guaranteed that if None is returned, then this is a namespace
package. Otherwise, this is a regular package or file module.
Sourcepub fn kind(self, db: &'db dyn Database) -> ModuleKind
pub fn kind(self, db: &'db dyn Database) -> ModuleKind
Determine whether this module is a single-file module or a package
Sourcepub fn all_submodules(self, db: &'db dyn Db) -> &'db [Module<'db>]
pub fn all_submodules(self, db: &'db dyn Db) -> &'db [Module<'db>]
Return a list of all submodules of this module.
Returns an empty list if the module is not a package, if it is an empty package,
or if it is a namespace package (one without an __init__.py or __init__.pyi file).
The names returned correspond to the “base” name of the module.
That is, {self.name}.{basename} should give the full module name.
Trait Implementations§
impl<'db> Copy for Module<'db>
impl<'db> Eq for Module<'db>
Source§impl GetSize for Module<'_>
impl GetSize for Module<'_>
Source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Source§fn get_heap_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_heap_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreSource§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreSource§impl<'db> PartialEq for Module<'db>
impl<'db> PartialEq for Module<'db>
Source§impl<'db> SalsaStructInDb for Module<'db>
impl<'db> SalsaStructInDb for Module<'db>
Source§const LEAF_TYPE_IDS: &'static [ConstTypeId]
const LEAF_TYPE_IDS: &'static [ConstTypeId]
type MemoIngredientMap = MemoIngredientIndices
Source§fn lookup_ingredient_index(__zalsa: &Zalsa) -> IngredientIndices
fn lookup_ingredient_index(__zalsa: &Zalsa) -> IngredientIndices
Source§fn entries(zalsa: &Zalsa) -> impl Iterator<Item = DatabaseKeyIndex> + '_
fn entries(zalsa: &Zalsa) -> impl Iterator<Item = DatabaseKeyIndex> + '_
impl<'db> StructuralPartialEq for Module<'db>
Auto Trait Implementations§
impl<'db> Freeze for Module<'db>
impl<'db> RefUnwindSafe for Module<'db>
impl<'db> Send for Module<'db>
impl<'db> Sync for Module<'db>
impl<'db> Unpin for Module<'db>
impl<'db> UnsafeUnpin for Module<'db>
impl<'db> UnwindSafe for Module<'db>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> HashEqLike<&T> for T
impl<T> HashEqLike<&T> for T
Source§impl<T> HashEqLike<Cow<'_, T>> for T
impl<T> HashEqLike<Cow<'_, T>> for T
Source§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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