diff --git a/canome/src/bus.rs b/canome/src/bus.rs index 4a04049..6fcb422 100644 --- a/canome/src/bus.rs +++ b/canome/src/bus.rs @@ -50,11 +50,11 @@ pub trait BusBehaviour { impl> BusBehaviour for &T { fn get(&self, id: ::ID) -> Option<::Data> { - self.get(id) + (*self).get(id) } fn register_waker(&self, id: ::ID, waker: &Waker) { - self.register_waker(id, waker) + (*self).register_waker(id, waker) } fn publish( @@ -62,15 +62,15 @@ impl> BusBehaviour for &T { id: ::ID, value: ::Data, ) -> Result<(), BusError> { - self.publish(id, value) + (*self).publish(id, value) } fn publish_local(&self, id: &::ID, value: ::Data) { - self.publish_local(id, value) + (*self).publish_local(id, value) } fn request(&self, id: ::ID) -> Result<(), BusError> { - self.request(id) + (*self).request(id) } } diff --git a/canome/src/can.rs b/canome/src/can.rs index 80a6cb9..ca79d61 100644 --- a/canome/src/can.rs +++ b/canome/src/can.rs @@ -46,26 +46,7 @@ impl BusBackend for BxCanBus { } } -impl Default for BxCanBus { - fn default() -> Self { - Self { - tx_queue: MpMcQueue::new(), - on_publish: &Self::empty_hook, - } - } -} - impl BxCanBus { - pub const fn new() -> Self { - Self { - tx_queue: MpMcQueue::new(), - on_publish: &Self::empty_hook, - } - } - - #[inline] - fn empty_hook(&self) {} - pub const fn new_with_hook(on_publish: &'static (dyn Fn(&Self) + Send + Sync)) -> Self { Self { tx_queue: MpMcQueue::new(), @@ -118,7 +99,7 @@ impl BxCanBus { } } Err(nb::Error::WouldBlock) => break, - Err(nb::Error::Other(_)) => {} + Err(nb::Error::Other(_)) => break, } }