Skip to main content

PyCodeMethods

Trait PyCodeMethods 

Source
pub trait PyCodeMethods<'py> {
    // Required method
    fn run(
        &self,
        globals: Option<&Bound<'py, PyDict>>,
        locals: Option<&Bound<'py, PyDict>>,
    ) -> PyResult<Bound<'py, PyAny>>;
}
Expand description

Implementation of functionality for PyCode.

These methods are defined for the Bound<'py, PyCode> 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 run( &self, globals: Option<&Bound<'py, PyDict>>, locals: Option<&Bound<'py, PyDict>>, ) -> PyResult<Bound<'py, PyAny>>

Runs code object.

If globals is None, it defaults to Python module __main__. If locals is None, it defaults to the value of globals.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'py> PyCodeMethods<'py> for Bound<'py, PyCode>