-
Notifications
You must be signed in to change notification settings - Fork 952
Description
The capsule API (https://docs.python.org/3.8/c-api/capsule.html) can be useful for safely storing Rust data in a way that's not usable by Python without leaking it. This is possible because the capsule creation takes a destructor function.
Today it came up on Gitter that for rust-numpy it may be useful to do zero-copy transfer of arrays from Rust to Python, by stashing the backing storage (e.g. vec) in a capsule which is set as the base object to the numpy array.
Reactions are currently unavailable