Skip to main content

data_to_pycapsule

Function data_to_pycapsule 

Source
pub fn data_to_pycapsule(py: Python<'_>, data: Data) -> Py<PyAny>
Expand description

Creates a Python PyCapsule object containing a Rust Data instance.

This function takes ownership of the Data instance and encapsulates it within a PyCapsule object, allowing the Rust data to be passed into the Python runtime.

ยงPanics

This function panics if the PyCapsule creation fails, which may occur if there are issues with memory allocation or if the Data instance cannot be properly encapsulated.