Skip to main content

PyFrameMethods

Trait PyFrameMethods 

Source
pub trait PyFrameMethods<'py>: Sealed {
    // Required methods
    fn line_number(&self) -> i32;
    fn outer(&self) -> Option<Bound<'py, PyFrame>>;
    fn code(&self) -> Bound<'py, PyCode>;
    fn var(&self, name: &CStr) -> PyResult<Bound<'py, PyAny>>;
    fn builtins(&self) -> Bound<'py, PyDict>;
    fn globals(&self) -> Bound<'py, PyDict>;
    fn locals(&self) -> Bound<'py, PyAny>;
}
Expand description

Implementation of functionality for PyFrame.

These methods are defined for the Bound<'py, PyFrame> smart pointer, so to use method call syntax these methods are separated into a trait, because stable Rust does not yet support arbitrary_self_types.

Required Methods§

Source

fn line_number(&self) -> i32

Returns the line number of the current instruction in the frame.

Source

fn outer(&self) -> Option<Bound<'py, PyFrame>>

Gets this frame’s next outer frame if there is one

Source

fn code(&self) -> Bound<'py, PyCode>

Gets the frame code

Source

fn var(&self, name: &CStr) -> PyResult<Bound<'py, PyAny>>

Gets the variable name of this frame.

Source

fn builtins(&self) -> Bound<'py, PyDict>

Gets this frame’s f_builtins attribute

Source

fn globals(&self) -> Bound<'py, PyDict>

Gets this frame’s f_globals attribute

Source

fn locals(&self) -> Bound<'py, PyAny>

Gets this frame’s f_locals attribute

Implementors§

Source§

impl<'py> PyFrameMethods<'py> for Bound<'py, PyFrame>