Struct python_packaging::resource::PythonModuleBytecode
source · pub struct PythonModuleBytecode {
pub name: String,
pub optimize_level: BytecodeOptimizationLevel,
pub is_package: bool,
pub cache_tag: String,
pub is_stdlib: bool,
pub is_test: bool,
/* private fields */
}
Expand description
Compiled Python module bytecode.
Fields
name: String
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 PythonModuleBytecode
impl PythonModuleBytecode
pub fn new(
name: &str,
optimize_level: BytecodeOptimizationLevel,
is_package: bool,
cache_tag: &str,
data: &[u8]
) -> Self
pub fn from_path(
name: &str,
optimize_level: BytecodeOptimizationLevel,
cache_tag: &str,
path: &Path
) -> Self
pub fn description(&self) -> String
pub fn to_memory(&self) -> Result<Self>
sourcepub fn resolve_bytecode(&self) -> Result<Vec<u8>>
pub fn resolve_bytecode(&self) -> Result<Vec<u8>>
Resolve the bytecode data for this module.
sourcepub fn set_bytecode(&mut self, data: &[u8])
pub fn set_bytecode(&mut self, data: &[u8])
Sets the bytecode for this module.
sourcepub fn resolve_path(&self, prefix: &str) -> PathBuf
pub fn resolve_path(&self, prefix: &str) -> PathBuf
Resolve filesystem path to this bytecode.
Trait Implementations
sourceimpl Clone for PythonModuleBytecode
impl Clone for PythonModuleBytecode
sourcefn clone(&self) -> PythonModuleBytecode
fn clone(&self) -> PythonModuleBytecode
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 PythonModuleBytecode
impl Debug for PythonModuleBytecode
sourceimpl<'a> From<&'a PythonModuleBytecode> for PythonResource<'a>
impl<'a> From<&'a PythonModuleBytecode> for PythonResource<'a>
sourcefn from(m: &'a PythonModuleBytecode) -> Self
fn from(m: &'a PythonModuleBytecode) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<PythonModuleBytecode> for PythonResource<'a>
impl<'a> From<PythonModuleBytecode> for PythonResource<'a>
sourcefn from(m: PythonModuleBytecode) -> Self
fn from(m: PythonModuleBytecode) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<PythonModuleBytecode> for PythonModuleBytecode
impl PartialEq<PythonModuleBytecode> for PythonModuleBytecode
sourcefn eq(&self, other: &PythonModuleBytecode) -> bool
fn eq(&self, other: &PythonModuleBytecode) -> bool
impl StructuralPartialEq for PythonModuleBytecode
Auto Trait Implementations
impl RefUnwindSafe for PythonModuleBytecode
impl Send for PythonModuleBytecode
impl Sync for PythonModuleBytecode
impl Unpin for PythonModuleBytecode
impl UnwindSafe for PythonModuleBytecode
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