diff --git a/Cargo.toml b/Cargo.toml index ab7723059..ca4e0c584 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" # CI removes lines containing 'nightly-only' when not building with nightly. members = [ diff --git a/embedded-hal-async/src/delay.rs b/embedded-hal-async/src/delay.rs index 4b0223930..acf18f2af 100644 --- a/embedded-hal-async/src/delay.rs +++ b/embedded-hal-async/src/delay.rs @@ -13,7 +13,7 @@ pub trait DelayUs { impl DelayUs for &mut T where - T: DelayUs, + T: DelayUs + ?Sized, { async fn delay_us(&mut self, us: u32) { T::delay_us(self, us).await diff --git a/embedded-hal-async/src/digital.rs b/embedded-hal-async/src/digital.rs index 600876975..8f09eb78d 100644 --- a/embedded-hal-async/src/digital.rs +++ b/embedded-hal-async/src/digital.rs @@ -48,7 +48,7 @@ pub trait Wait: embedded_hal::digital::ErrorType { async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error>; } -impl Wait for &mut T { +impl Wait for &mut T { async fn wait_for_high(&mut self) -> Result<(), Self::Error> { T::wait_for_high(self).await } diff --git a/embedded-hal-async/src/i2c.rs b/embedded-hal-async/src/i2c.rs index 67712dd46..0837da8dd 100644 --- a/embedded-hal-async/src/i2c.rs +++ b/embedded-hal-async/src/i2c.rs @@ -122,7 +122,7 @@ pub trait I2c: ErrorType { ) -> Result<(), Self::Error>; } -impl> I2c for &mut T { +impl + ?Sized> I2c for &mut T { async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> { T::read(self, address, read).await } diff --git a/embedded-hal-async/src/spi.rs b/embedded-hal-async/src/spi.rs index 2c05f56e4..834a37fd2 100644 --- a/embedded-hal-async/src/spi.rs +++ b/embedded-hal-async/src/spi.rs @@ -76,7 +76,7 @@ pub trait SpiDevice: ErrorType { } } -impl> SpiDevice for &mut T { +impl + ?Sized> SpiDevice for &mut T { async fn transaction( &mut self, operations: &mut [Operation<'_, Word>], @@ -149,7 +149,7 @@ pub trait SpiBus: ErrorType { async fn flush(&mut self) -> Result<(), Self::Error>; } -impl, Word: 'static + Copy> SpiBus for &mut T { +impl + ?Sized, Word: 'static + Copy> SpiBus for &mut T { async fn read(&mut self, words: &mut [Word]) -> Result<(), Self::Error> { T::read(self, words).await } diff --git a/embedded-hal-nb/src/serial.rs b/embedded-hal-nb/src/serial.rs index c069c1441..624aadee3 100644 --- a/embedded-hal-nb/src/serial.rs +++ b/embedded-hal-nb/src/serial.rs @@ -69,7 +69,7 @@ pub trait ErrorType { type Error: Error; } -impl ErrorType for &mut T { +impl ErrorType for &mut T { type Error = T::Error; } @@ -82,7 +82,7 @@ pub trait Read: ErrorType { fn read(&mut self) -> nb::Result; } -impl, Word: Copy> Read for &mut T { +impl + ?Sized, Word: Copy> Read for &mut T { fn read(&mut self) -> nb::Result { T::read(self) } @@ -97,7 +97,7 @@ pub trait Write: ErrorType { fn flush(&mut self) -> nb::Result<(), Self::Error>; } -impl, Word: Copy> Write for &mut T { +impl + ?Sized, Word: Copy> Write for &mut T { fn write(&mut self, word: Word) -> nb::Result<(), Self::Error> { T::write(self, word) } diff --git a/embedded-hal-nb/src/spi.rs b/embedded-hal-nb/src/spi.rs index a9e7c94f0..ecdb88ffb 100644 --- a/embedded-hal-nb/src/spi.rs +++ b/embedded-hal-nb/src/spi.rs @@ -31,7 +31,7 @@ pub trait FullDuplex: ErrorType { fn write(&mut self, word: Word) -> nb::Result<(), Self::Error>; } -impl, Word: Copy> FullDuplex for &mut T { +impl + ?Sized, Word: Copy> FullDuplex for &mut T { fn read(&mut self) -> nb::Result { T::read(self) } diff --git a/embedded-hal/src/delay.rs b/embedded-hal/src/delay.rs index 7486f412f..da4cd7e2d 100644 --- a/embedded-hal/src/delay.rs +++ b/embedded-hal/src/delay.rs @@ -18,7 +18,7 @@ pub trait DelayUs { impl DelayUs for &mut T where - T: DelayUs, + T: DelayUs + ?Sized, { fn delay_us(&mut self, us: u32) { T::delay_us(self, us) diff --git a/embedded-hal/src/digital.rs b/embedded-hal/src/digital.rs index c476cb769..677bb64d1 100644 --- a/embedded-hal/src/digital.rs +++ b/embedded-hal/src/digital.rs @@ -55,11 +55,11 @@ pub trait ErrorType { type Error: Error; } -impl ErrorType for &T { +impl ErrorType for &T { type Error = T::Error; } -impl ErrorType for &mut T { +impl ErrorType for &mut T { type Error = T::Error; } @@ -139,7 +139,7 @@ pub trait OutputPin: ErrorType { } } -impl OutputPin for &mut T { +impl OutputPin for &mut T { fn set_low(&mut self) -> Result<(), Self::Error> { T::set_low(self) } @@ -166,7 +166,7 @@ pub trait StatefulOutputPin: OutputPin { fn is_set_low(&self) -> Result; } -impl StatefulOutputPin for &mut T { +impl StatefulOutputPin for &mut T { fn is_set_high(&self) -> Result { T::is_set_high(self) } @@ -182,7 +182,7 @@ pub trait ToggleableOutputPin: ErrorType { fn toggle(&mut self) -> Result<(), Self::Error>; } -impl ToggleableOutputPin for &mut T { +impl ToggleableOutputPin for &mut T { fn toggle(&mut self) -> Result<(), Self::Error> { T::toggle(self) } @@ -197,7 +197,7 @@ pub trait InputPin: ErrorType { fn is_low(&self) -> Result; } -impl InputPin for &T { +impl InputPin for &T { fn is_high(&self) -> Result { T::is_high(self) } diff --git a/embedded-hal/src/i2c.rs b/embedded-hal/src/i2c.rs index fdaf9e15c..735408758 100644 --- a/embedded-hal/src/i2c.rs +++ b/embedded-hal/src/i2c.rs @@ -249,7 +249,7 @@ pub trait ErrorType { type Error: Error; } -impl ErrorType for &mut T { +impl ErrorType for &mut T { type Error = T::Error; } @@ -372,7 +372,7 @@ pub trait I2c: ErrorType { ) -> Result<(), Self::Error>; } -impl> I2c for &mut T { +impl + ?Sized> I2c for &mut T { fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> { T::read(self, address, read) } diff --git a/embedded-hal/src/pwm.rs b/embedded-hal/src/pwm.rs index 1ba9c4df0..4c0f6ac60 100644 --- a/embedded-hal/src/pwm.rs +++ b/embedded-hal/src/pwm.rs @@ -53,7 +53,7 @@ pub trait ErrorType { type Error: Error; } -impl ErrorType for &mut T { +impl ErrorType for &mut T { type Error = T::Error; } @@ -101,7 +101,7 @@ pub trait SetDutyCycle: ErrorType { } } -impl SetDutyCycle for &mut T { +impl SetDutyCycle for &mut T { fn get_max_duty_cycle(&self) -> u16 { T::get_max_duty_cycle(self) } diff --git a/embedded-hal/src/spi.rs b/embedded-hal/src/spi.rs index 3bcdda795..54bf8bcea 100644 --- a/embedded-hal/src/spi.rs +++ b/embedded-hal/src/spi.rs @@ -288,7 +288,7 @@ pub trait ErrorType { type Error: Error; } -impl ErrorType for &mut T { +impl ErrorType for &mut T { type Error = T::Error; } @@ -378,7 +378,7 @@ pub trait SpiDevice: ErrorType { } } -impl> SpiDevice for &mut T { +impl + ?Sized> SpiDevice for &mut T { fn transaction(&mut self, operations: &mut [Operation<'_, Word>]) -> Result<(), Self::Error> { T::transaction(self, operations) } @@ -448,7 +448,7 @@ pub trait SpiBus: ErrorType { fn flush(&mut self) -> Result<(), Self::Error>; } -impl, Word: Copy + 'static> SpiBus for &mut T { +impl + ?Sized, Word: Copy + 'static> SpiBus for &mut T { fn read(&mut self, words: &mut [Word]) -> Result<(), Self::Error> { T::read(self, words) }