[][src]Struct rustpython_vm::bytecode::CodeObject

pub struct CodeObject {
    pub instructions: Vec<Instruction>,
    pub label_map: HashMap<Label, usize, RandomState>,
    pub locations: Vec<Location>,
    pub flags: CodeFlags,
    pub arg_names: Vec<String>,
    pub varargs: Varargs,
    pub kwonlyarg_names: Vec<String>,
    pub varkeywords: Varargs,
    pub source_path: String,
    pub first_line_number: usize,
    pub obj_name: String,
}

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, RandomState>

Jump targets.

locations: Vec<Location>flags: CodeFlagsarg_names: Vec<String>varargs: Varargskwonlyarg_names: Vec<String>varkeywords: Varargssource_path: Stringfirst_line_number: usizeobj_name: String

Methods

impl CodeObject[src]

pub fn new(
    flags: CodeFlags,
    arg_names: Vec<String>,
    varargs: Varargs,
    kwonlyarg_names: Vec<String>,
    varkeywords: Varargs,
    source_path: String,
    first_line_number: usize,
    obj_name: String
) -> CodeObject
[src]

pub fn from_bytes(data: &[u8]) -> Result<CodeObject, Box<dyn Error + 'static>>[src]

Load a code object from bytes

pub fn to_bytes(&self) -> Vec<u8>[src]

Serialize this bytecode to bytes.

pub fn get_constants(&self) -> impl Iterator<Item = &Constant>[src]

pub fn display_expand_codeobjects(&'a self) -> impl Display + 'a[src]

Trait Implementations

impl Clone for CodeObject[src]

impl Debug for CodeObject[src]

impl<'de> Deserialize<'de> for CodeObject[src]

impl Display for CodeObject[src]

impl From<CodeObjectStream> for CodeObject[src]

impl<O> From<PeepholeOptimizer<O>> for CodeObject where
    O: OutputStream, 
[src]

impl PartialEq<CodeObject> for CodeObject[src]

impl Serialize for CodeObject[src]

impl StructuralPartialEq for CodeObject[src]

Auto Trait Implementations

impl RefUnwindSafe for CodeObject

impl Send for CodeObject

impl Sync for CodeObject

impl Unpin for CodeObject

impl UnwindSafe for CodeObject

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,