From 16d495aa5cd385b8e66ecae98703c70f3cdc5001 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 9 Jul 2023 18:31:56 +0200 Subject: [PATCH] remove some more muts --- satrs-core/src/event_man.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/satrs-core/src/event_man.rs b/satrs-core/src/event_man.rs index c556e99..3fb8d68 100644 --- a/satrs-core/src/event_man.rs +++ b/satrs-core/src/event_man.rs @@ -89,14 +89,10 @@ pub trait SendEventProvider { type Error; fn id(&self) -> SenderId; - fn send_no_data(&mut self, event: Provider) -> Result<(), Self::Error> { + fn send_no_data(&self, event: Provider) -> Result<(), Self::Error> { self.send(event, None) } - fn send( - &mut self, - event: Provider, - aux_data: Option, - ) -> Result<(), Self::Error>; + fn send(&self, event: Provider, aux_data: Option) -> Result<(), Self::Error>; } /// Generic abstraction for an event receiver. @@ -107,7 +103,7 @@ pub trait EventReceiver { /// To allow returning arbitrary additional auxiliary data, a mutable slice is passed to the /// [Self::receive] call as well. Receivers can write data to this slice, but care must be taken /// to avoid panics due to size missmatches or out of bound writes. - fn receive(&mut self) -> Option<(Event, Option)>; + fn receive(&self) -> Option<(Event, Option)>; } pub trait ListenerTable { @@ -424,7 +420,7 @@ pub mod stdmod { } } impl EventReceiver for MpscEventReceiver { - fn receive(&mut self) -> Option> { + fn receive(&self) -> Option> { if let Ok(event_and_data) = self.mpsc_receiver.try_recv() { return Some(event_and_data); } @@ -453,7 +449,7 @@ pub mod stdmod { fn id(&self) -> u32 { self.id } - fn send(&mut self, event: Event, aux_data: Option) -> Result<(), Self::Error> { + fn send(&self, event: Event, aux_data: Option) -> Result<(), Self::Error> { self.sender.send((event, aux_data)) } }