pub struct CodeObject {
pub instructions: Vec<Instruction>,
pub label_map: HashMap<Label, usize>,
pub locations: Vec<Location>,
pub flags: CodeFlags,
pub posonlyarg_count: usize,
pub arg_names: Vec<String>,
pub varargs_name: Option<String>,
pub kwonlyarg_names: Vec<String>,
pub varkeywords_name: Option<String>,
pub source_path: String,
pub first_line_number: usize,
pub obj_name: String,
}
Expand description
Primary container of a single code object. Each python function has a codeobject. Also a module has a codeobject.
Fields§
§instructions: Vec<Instruction>
§label_map: HashMap<Label, usize>
Jump targets.
locations: Vec<Location>
§flags: CodeFlags
§posonlyarg_count: usize
§arg_names: Vec<String>
§varargs_name: Option<String>
§kwonlyarg_names: Vec<String>
§varkeywords_name: Option<String>
§source_path: String
§first_line_number: usize
§obj_name: String
Implementations§
Source§impl CodeObject
impl CodeObject
pub fn new( flags: CodeFlags, posonlyarg_count: usize, arg_names: Vec<String>, varargs_name: Option<String>, kwonlyarg_names: Vec<String>, varkeywords_name: Option<String>, source_path: String, first_line_number: usize, obj_name: String, ) -> CodeObject
pub fn get_constants(&self) -> impl Iterator<Item = &Constant>
pub fn varnames(&self) -> impl Iterator<Item = &str> + '_
pub fn display_expand_codeobjects<'a>(&'a self) -> impl Display + 'a
Trait Implementations§
Source§impl Clone for CodeObject
impl Clone for CodeObject
Source§fn clone(&self) -> CodeObject
fn clone(&self) -> CodeObject
Returns a copy 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 Debug for CodeObject
impl Debug for CodeObject
Source§impl<'de> Deserialize<'de> for CodeObject
impl<'de> Deserialize<'de> for CodeObject
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CodeObject
impl Display for CodeObject
Source§impl PartialEq for CodeObject
impl PartialEq for CodeObject
Source§impl Serialize for CodeObject
impl Serialize for CodeObject
impl StructuralPartialEq for CodeObject
Auto Trait Implementations§
impl Freeze for CodeObject
impl RefUnwindSafe for CodeObject
impl Send for CodeObject
impl Sync for CodeObject
impl Unpin for CodeObject
impl UnwindSafe for CodeObject
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