diff --git a/apis/c++/node/src/lib.rs b/apis/c++/node/src/lib.rs index 2e5f1314..e953961a 100644 --- a/apis/c++/node/src/lib.rs +++ b/apis/c++/node/src/lib.rs @@ -30,11 +30,11 @@ mod ffi { extern "Rust" { type Events; type OutputSender; - type DoraEvent<'a>; + type DoraEvent; fn init_dora_node() -> Result; - fn next_event(inputs: &mut Box) -> Box>; + fn next_event(inputs: &mut Box) -> Box; fn event_type(event: &Box) -> DoraEventType; fn event_as_input(event: Box) -> Result; fn send_output( @@ -62,7 +62,7 @@ fn next_event(events: &mut Box) -> Box { Box::new(DoraEvent(events.0.recv())) } -pub struct DoraEvent<'a>(Option>); +pub struct DoraEvent(Option); fn event_type(event: &DoraEvent) -> ffi::DoraEventType { match &event.0 { diff --git a/apis/python/node/src/lib.rs b/apis/python/node/src/lib.rs index eb9eb1fd..113ced22 100644 --- a/apis/python/node/src/lib.rs +++ b/apis/python/node/src/lib.rs @@ -14,9 +14,9 @@ pub struct Node { node: DoraNode, } -pub struct PyInput<'a>(Event<'a>); +pub struct PyInput(Event); -impl IntoPy for PyInput<'_> { +impl IntoPy for PyInput { fn into_py(self, py: Python) -> PyObject { let dict = PyDict::new(py); diff --git a/apis/rust/node/src/event.rs b/apis/rust/node/src/event.rs index 090513ef..5cd96571 100644 --- a/apis/rust/node/src/event.rs +++ b/apis/rust/node/src/event.rs @@ -9,7 +9,7 @@ use shared_memory::{Shmem, ShmemConf}; #[derive(Debug)] #[non_exhaustive] -pub enum Event<'a> { +pub enum Event { Stop, Reload { operator_id: Option, @@ -17,7 +17,7 @@ pub enum Event<'a> { Input { id: DataId, metadata: Metadata<'static>, - data: Option>, + data: Option, }, InputClosed { id: DataId, @@ -25,15 +25,15 @@ pub enum Event<'a> { Error(String), } -pub enum Data<'a> { +pub enum Data { Vec(Vec), SharedMemory { - data: MappedInputData<'a>, - _drop: std::sync::mpsc::Sender<()>, + data: MappedInputData, + _drop: flume::Sender<()>, }, } -impl std::ops::Deref for Data<'_> { +impl std::ops::Deref for Data { type Target = [u8]; fn deref(&self) -> &Self::Target { @@ -44,33 +44,28 @@ impl std::ops::Deref for Data<'_> { } } -impl std::fmt::Debug for Data<'_> { +impl std::fmt::Debug for Data { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Data").finish_non_exhaustive() } } -pub struct MappedInputData<'a> { +pub struct MappedInputData { memory: Shmem, len: usize, - _data: PhantomData<&'a [u8]>, } -impl MappedInputData<'_> { +impl MappedInputData { pub(crate) unsafe fn map(shared_memory_id: &str, len: usize) -> eyre::Result { let memory = ShmemConf::new() .os_id(shared_memory_id) .open() .wrap_err("failed to map shared memory input")?; - Ok(MappedInputData { - memory, - len, - _data: PhantomData, - }) + Ok(MappedInputData { memory, len }) } } -impl std::ops::Deref for MappedInputData<'_> { +impl std::ops::Deref for MappedInputData { type Target = [u8]; fn deref(&self) -> &Self::Target {