From 511c9ea3decc195a4e23534b877241412dbb7d23 Mon Sep 17 00:00:00 2001 From: Alexander Clausen Date: Mon, 17 Jun 2024 08:55:07 +0200 Subject: [PATCH] WIP --- common/Cargo.toml | 2 +- common/src/lib.rs | 1 + common/src/py_buffer_for_slot.rs | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 common/src/py_buffer_for_slot.rs diff --git a/common/Cargo.toml b/common/Cargo.toml index 371ef77d..b776b50d 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" bincode = "1.3.3" ipc-test = { path = "../ipc_test" } stats = { path = "../stats" } -pyo3 = "0.21.2" +pyo3 = { version = "0.21.2", features = ["abi3-py37"] } numpy = "0.21" serde = "1.0.199" tempfile = "3.10.1" diff --git a/common/src/lib.rs b/common/src/lib.rs index 2f2ef0ef..8e029341 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -4,6 +4,7 @@ pub mod decoder; pub mod frame_stack; pub mod generic_connection; pub mod generic_receiver; +pub mod py_buffer_for_slot; pub mod py_cam_client; pub mod py_connection; pub mod stats; diff --git a/common/src/py_buffer_for_slot.rs b/common/src/py_buffer_for_slot.rs new file mode 100644 index 00000000..4d839246 --- /dev/null +++ b/common/src/py_buffer_for_slot.rs @@ -0,0 +1,19 @@ +use std::ffi::c_int; + +use ipc_test::Slot; +use pyo3::{ffi, pyclass, pymethods}; + +// FIXME: can/should we make this Send'able? +#[pyclass(unsendable)] +struct SlotBuffer { + slot: Slot, +} + +impl SlotBuffer {} + +#[pymethods] +impl SlotBuffer { + unsafe fn __getbuffer__(&self, view: *mut ffi::Py_buffer, flags: c_int) { + todo!() + } +}