Struct erg_compiler::ty::codeobj::CodeObj
source · pub struct CodeObj {Show 18 fields
pub argcount: u32,
pub posonlyargcount: u32,
pub kwonlyargcount: u32,
pub nlocals: u32,
pub stacksize: u32,
pub flags: u32,
pub code: Vec<u8>,
pub consts: Vec<ValueObj>,
pub names: Vec<Str>,
pub varnames: Vec<Str>,
pub freevars: Vec<Str>,
pub cellvars: Vec<Str>,
pub filename: Str,
pub name: Str,
pub qualname: Str,
pub firstlineno: u32,
pub lnotab: Vec<u8>,
pub exceptiontable: Vec<u8>,
}
Expand description
Implementation of PyCodeObject
, see Include/cpython/code.h in CPython for details.
Fields§
§argcount: u32
§posonlyargcount: u32
§kwonlyargcount: u32
§nlocals: u32
§stacksize: u32
§flags: u32
§code: Vec<u8>
§consts: Vec<ValueObj>
§names: Vec<Str>
§varnames: Vec<Str>
§freevars: Vec<Str>
§cellvars: Vec<Str>
§filename: Str
§name: Str
§qualname: Str
§firstlineno: u32
§lnotab: Vec<u8>
§exceptiontable: Vec<u8>
Implementations§
source§impl CodeObj
impl CodeObj
pub fn empty<S: Into<Str>, T: Into<Str>>( params: Vec<Str>, filename: S, name: T, firstlineno: u32, flags: u32 ) -> Self
pub fn from_pyc<P: AsRef<Path>>(path: P) -> DeserializeResult<Self>
pub fn from_bytes( v: &mut Vec<u8>, python_ver: PythonVersion ) -> DeserializeResult<Self>
pub fn into_bytes(self, python_ver: PythonVersion) -> Vec<u8>
pub fn dump_as_pyc<P: AsRef<Path>>( self, path: P, py_magic_num: Option<u32> ) -> Result<()>
pub fn code_info(&self, py_ver: Option<PythonVersion>) -> String
Trait Implementations§
source§impl HasType for CodeObj
impl HasType for CodeObj
fn ref_t(&self) -> &Type
source§fn ref_mut_t(&mut self) -> &mut Type
fn ref_mut_t(&mut self) -> &mut Type
x.ref_mut_t()
may panic, in which case x
is Call
and x.ref_t() == Type::Failure
.fn signature_t(&self) -> Option<&Type>
fn signature_mut_t(&mut self) -> Option<&mut Type>
fn t(&self) -> Type
fn inner_ts(&self) -> Vec<Type>
fn lhs_t(&self) -> &Type
fn rhs_t(&self) -> &Type
source§impl PartialEq<CodeObj> for CodeObj
impl PartialEq<CodeObj> for CodeObj
impl Eq for CodeObj
impl StructuralEq for CodeObj
impl StructuralPartialEq for CodeObj
Auto Trait Implementations§
impl !RefUnwindSafe for CodeObj
impl !Send for CodeObj
impl !Sync for CodeObj
impl Unpin for CodeObj
impl !UnwindSafe for CodeObj
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