pub struct PythonModuleBytecodeFromSource {
pub name: String,
pub source: FileData,
pub optimize_level: BytecodeOptimizationLevel,
pub is_package: bool,
pub cache_tag: String,
pub is_stdlib: bool,
pub is_test: bool,
}
Expand description
Python module bytecode defined via source code.
This is essentially a request to generate bytecode from Python module source code.
Fields
name: String
source: FileData
optimize_level: BytecodeOptimizationLevel
is_package: bool
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 PythonModuleBytecodeFromSource
impl PythonModuleBytecodeFromSource
pub fn description(&self) -> String
pub fn to_memory(&self) -> Result<Self>
sourcepub fn compile(
&self,
compiler: &mut dyn PythonBytecodeCompiler,
mode: CompileMode
) -> Result<Vec<u8>>
pub fn compile(
&self,
compiler: &mut dyn PythonBytecodeCompiler,
mode: CompileMode
) -> Result<Vec<u8>>
Compile source to bytecode using a compiler.
sourcepub fn resolve_path(&self, prefix: &str) -> PathBuf
pub fn resolve_path(&self, prefix: &str) -> PathBuf
Resolve filesystem path to this bytecode.
sourcepub fn has_dunder_file(&self) -> Result<bool>
pub fn has_dunder_file(&self) -> Result<bool>
Whether the source for this module has file.
Trait Implementations
sourceimpl Clone for PythonModuleBytecodeFromSource
impl Clone for PythonModuleBytecodeFromSource
sourcefn clone(&self) -> PythonModuleBytecodeFromSource
fn clone(&self) -> PythonModuleBytecodeFromSource
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<'a> From<&'a PythonModuleBytecodeFromSource> for PythonResource<'a>
impl<'a> From<&'a PythonModuleBytecodeFromSource> for PythonResource<'a>
sourcefn from(m: &'a PythonModuleBytecodeFromSource) -> Self
fn from(m: &'a PythonModuleBytecodeFromSource) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<PythonModuleBytecodeFromSource> for PythonResource<'a>
impl<'a> From<PythonModuleBytecodeFromSource> for PythonResource<'a>
sourcefn from(m: PythonModuleBytecodeFromSource) -> Self
fn from(m: PythonModuleBytecodeFromSource) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<PythonModuleBytecodeFromSource> for PythonModuleBytecodeFromSource
impl PartialEq<PythonModuleBytecodeFromSource> for PythonModuleBytecodeFromSource
sourcefn eq(&self, other: &PythonModuleBytecodeFromSource) -> bool
fn eq(&self, other: &PythonModuleBytecodeFromSource) -> bool
impl StructuralPartialEq for PythonModuleBytecodeFromSource
Auto Trait Implementations
impl RefUnwindSafe for PythonModuleBytecodeFromSource
impl Send for PythonModuleBytecodeFromSource
impl Sync for PythonModuleBytecodeFromSource
impl Unpin for PythonModuleBytecodeFromSource
impl UnwindSafe for PythonModuleBytecodeFromSource
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