pub struct CodeObject<C: Constant = ConstantData> {
Show 16 fields pub instructions: Box<[Instruction]>, pub locations: Box<[Location]>, pub flags: CodeFlags, pub posonlyarg_count: usize, pub arg_count: usize, pub kwonlyarg_count: usize, pub source_path: C::Name, pub first_line_number: usize, pub max_stackdepth: u32, pub obj_name: C::Name, pub cell2arg: Option<Box<[isize]>>, pub constants: Box<[C]>, pub names: Box<[C::Name]>, pub varnames: Box<[C::Name]>, pub cellvars: Box<[C::Name]>, pub freevars: Box<[C::Name]>,
}
Expand description

Primary container of a single code object. Each python function has a codeobject. Also a module has a codeobject.

Fields§

§instructions: Box<[Instruction]>§locations: Box<[Location]>§flags: CodeFlags§posonlyarg_count: usize§arg_count: usize§kwonlyarg_count: usize§source_path: C::Name§first_line_number: usize§max_stackdepth: u32§obj_name: C::Name§cell2arg: Option<Box<[isize]>>§constants: Box<[C]>§names: Box<[C::Name]>§varnames: Box<[C::Name]>§cellvars: Box<[C::Name]>§freevars: Box<[C::Name]>

Implementations§

Get all arguments of the code object like inspect.getargs

Return the labels targeted by the instructions of this CodeObject

Recursively display this CodeObject

Map this CodeObject to one that holds a Bag::Constant

Same as map_bag but clones self

Load a code object from bytes

Serialize this bytecode to bytes.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.