Trait PyAppHandleExt

Source
pub trait PyAppHandleExt: Manager<Runtime> + SealedPyAppHandleExt {
    // Provided methods
    fn py_app_handle(&self) -> &Py<AppHandle> { ... }
    fn try_py_app_handle(&self) -> PyAppHandleStateResult<&Py<AppHandle>> { ... }
    fn get_or_init_py_app_handle(
        &self,
        py: Python<'_>,
    ) -> PyResult<&Py<AppHandle>> { ... }
}
Expand description

You can use this trait to get the global singleton Py<AppHandle>.

Provided Methods§

Source

fn py_app_handle(&self) -> &Py<AppHandle>

See PyAppHandleExt::try_py_app_handle for details.

§Panics

Panics if PyAppHandleExt::try_py_app_handle returns an error.

Source

fn try_py_app_handle(&self) -> PyAppHandleStateResult<&Py<AppHandle>>

Get the global singleton Py<AppHandle>.

If it has not been initialized, it will return an error. Use PyAppHandleExt::get_or_init_py_app_handle to initialize.

Source

fn get_or_init_py_app_handle(&self, py: Python<'_>) -> PyResult<&Py<AppHandle>>

Get or initialize the global singleton Py<AppHandle>.

It may return an error only during the first initialization. Once successfully called for the first time, subsequent calls will always return Ok.

crate::ext_mod::App::try_build will call this method, which means if you already have an crate::ext_mod::App instance, the AppHandle has also been initialized.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§