Struct python_packaging::resource::PythonModuleSource
source · 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: String
The fully qualified Python module name.
source: FileData
Python source code.
is_package: bool
Whether this module is also a package.
cache_tag: String
Tag to apply to bytecode files.
e.g. cpython-39
.
is_stdlib: bool
Whether this module belongs to the Python standard library.
Modules with this set are distributed as part of Python itself.
is_test: bool
Whether 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
sourceimpl 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
sourceimpl Clone for PythonModuleSource
impl Clone for PythonModuleSource
sourcefn clone(&self) -> PythonModuleSource
fn clone(&self) -> PythonModuleSource
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for PythonModuleSource
impl Debug for PythonModuleSource
sourceimpl<'a> From<&'a PythonModuleSource> for PythonResource<'a>
impl<'a> From<&'a PythonModuleSource> for PythonResource<'a>
sourcefn from(m: &'a PythonModuleSource) -> Self
fn from(m: &'a PythonModuleSource) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<PythonModuleSource> for PythonResource<'a>
impl<'a> From<PythonModuleSource> for PythonResource<'a>
sourcefn from(m: PythonModuleSource) -> Self
fn from(m: PythonModuleSource) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<PythonModuleSource> for PythonModuleSource
impl PartialEq<PythonModuleSource> for PythonModuleSource
sourcefn eq(&self, other: &PythonModuleSource) -> bool
fn eq(&self, other: &PythonModuleSource) -> bool
impl StructuralPartialEq for PythonModuleSource
Auto Trait Implementations
impl RefUnwindSafe for PythonModuleSource
impl Send for PythonModuleSource
impl Sync for PythonModuleSource
impl Unpin for PythonModuleSource
impl UnwindSafe for PythonModuleSource
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more