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: 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 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§
Source§impl Clone for PythonModuleBytecodeFromSource
impl Clone for PythonModuleBytecodeFromSource
Source§fn clone(&self) -> PythonModuleBytecodeFromSource
fn clone(&self) -> PythonModuleBytecodeFromSource
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<'a> From<&'a PythonModuleBytecodeFromSource> for PythonResource<'a>
impl<'a> From<&'a PythonModuleBytecodeFromSource> for PythonResource<'a>
Source§fn from(m: &'a PythonModuleBytecodeFromSource) -> Self
fn from(m: &'a PythonModuleBytecodeFromSource) -> Self
Converts to this type from the input type.
Source§impl<'a> From<PythonModuleBytecodeFromSource> for PythonResource<'a>
impl<'a> From<PythonModuleBytecodeFromSource> for PythonResource<'a>
Source§fn from(m: PythonModuleBytecodeFromSource) -> Self
fn from(m: PythonModuleBytecodeFromSource) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PythonModuleBytecodeFromSource
impl PartialEq for PythonModuleBytecodeFromSource
Source§fn eq(&self, other: &PythonModuleBytecodeFromSource) -> bool
fn eq(&self, other: &PythonModuleBytecodeFromSource) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PythonModuleBytecodeFromSource
Auto Trait Implementations§
impl Freeze for PythonModuleBytecodeFromSource
impl RefUnwindSafe for PythonModuleBytecodeFromSource
impl Send for PythonModuleBytecodeFromSource
impl Sync for PythonModuleBytecodeFromSource
impl Unpin for PythonModuleBytecodeFromSource
impl UnwindSafe for PythonModuleBytecodeFromSource
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