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§
Sourcefn line_number(&self) -> i32
fn line_number(&self) -> i32
Returns the line number of the current instruction in the frame.
Sourcefn outer(&self) -> Option<Bound<'py, PyFrame>>
Available on neither Py_LIMITED_API nor PyPy.
fn outer(&self) -> Option<Bound<'py, PyFrame>>
Py_LIMITED_API nor PyPy.Gets this frame’s next outer frame if there is one
Sourcefn code(&self) -> Bound<'py, PyCode>
Available on (Py_3_10 or non-Py_LIMITED_API) and (Py_3_12 or non-PyPy) only.
fn code(&self) -> Bound<'py, PyCode>
Py_3_10 or non-Py_LIMITED_API) and (Py_3_12 or non-PyPy) only.Gets the frame code
Sourcefn var(&self, name: &CStr) -> PyResult<Bound<'py, PyAny>>
Available on Py_3_12 and non-Py_LIMITED_API only.
fn var(&self, name: &CStr) -> PyResult<Bound<'py, PyAny>>
Py_3_12 and non-Py_LIMITED_API only.Gets the variable name of this frame.
Sourcefn builtins(&self) -> Bound<'py, PyDict>
Available on Py_3_11 and non-Py_LIMITED_API only.
fn builtins(&self) -> Bound<'py, PyDict>
Py_3_11 and non-Py_LIMITED_API only.Gets this frame’s f_builtins attribute
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".