Skip to main content

from_pycapsule

Macro from_pycapsule 

Source
macro_rules! from_pycapsule {
    ($fn_name:ident, $capsule_name:literal, $ffi_type:ty, $output_type:ty) => { ... };
}
Expand description

Define a <fn_name>(obj) -> PyResult<Arc<$output_type>> extractor that accepts either a raw PyCapsule carrying $ffi_type or any object exposing __<capsule_name>__() that returns one.

Use this when Arc<$output_type>: From<&$ffi_type> (infallible conversion). For fallible conversions use try_from_pycapsule! instead.