pub struct PythonModuleSource {
pub name: String,
pub source: FileData,
pub is_package: bool,
pub cache_tag: String,
pub is_stdlib: bool,
pub is_test: bool,
}Expand description
A Python module defined via source code.
Fields§
§name: StringThe fully qualified Python module name.
source: FileDataPython source code.
is_package: boolWhether this module is also a package.
cache_tag: StringTag to apply to bytecode files.
e.g. cpython-39.
is_stdlib: boolWhether this module belongs to the Python standard library.
Modules with this set are distributed as part of Python itself.
is_test: boolWhether this module is a test module.
Test modules are those defining test code and aren’t critical to run-time functionality of a package.
Implementations§
Source§impl PythonModuleSource
impl PythonModuleSource
pub fn description(&self) -> String
pub fn to_memory(&self) -> Result<Self>
Sourcepub fn package(&self) -> String
pub fn package(&self) -> String
Resolve the package containing this module.
If this module is a package, returns the name of self.
Sourcepub fn top_level_package(&self) -> &str
pub fn top_level_package(&self) -> &str
Obtain the top-level package name this module belongs to.
Sourcepub fn as_bytecode_module(
&self,
optimize_level: BytecodeOptimizationLevel,
) -> PythonModuleBytecodeFromSource
pub fn as_bytecode_module( &self, optimize_level: BytecodeOptimizationLevel, ) -> PythonModuleBytecodeFromSource
Convert the instance to a BytecodeModule.
Sourcepub fn resolve_path(&self, prefix: &str) -> PathBuf
pub fn resolve_path(&self, prefix: &str) -> PathBuf
Resolve the filesystem path for this source module.
Sourcepub fn has_dunder_file(&self) -> Result<bool>
pub fn has_dunder_file(&self) -> Result<bool>
Whether the source code for this module has file
Trait Implementations§
Source§impl Clone for PythonModuleSource
impl Clone for PythonModuleSource
Source§fn clone(&self) -> PythonModuleSource
fn clone(&self) -> PythonModuleSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PythonModuleSource
impl Debug for PythonModuleSource
Source§impl<'a> From<&'a PythonModuleSource> for PythonResource<'a>
impl<'a> From<&'a PythonModuleSource> for PythonResource<'a>
Source§fn from(m: &'a PythonModuleSource) -> Self
fn from(m: &'a PythonModuleSource) -> Self
Converts to this type from the input type.
Source§impl<'a> From<PythonModuleSource> for PythonResource<'a>
impl<'a> From<PythonModuleSource> for PythonResource<'a>
Source§fn from(m: PythonModuleSource) -> Self
fn from(m: PythonModuleSource) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PythonModuleSource
impl PartialEq for PythonModuleSource
impl StructuralPartialEq for PythonModuleSource
Auto Trait Implementations§
impl Freeze for PythonModuleSource
impl RefUnwindSafe for PythonModuleSource
impl Send for PythonModuleSource
impl Sync for PythonModuleSource
impl Unpin for PythonModuleSource
impl UnwindSafe for PythonModuleSource
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§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