Skip to content

Commit 17e51e9

Browse files
rmjaeldruin
authored andcommitted
Actually make embedded-storage-async compile
1 parent 5e871a8 commit 17e51e9

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

embedded-storage-async/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
Cargo.lock

embedded-storage-async/src/nor_flash.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ pub trait NorFlash: ReadNorFlash {
5252
impl<T: ReadNorFlash> ReadNorFlash for &mut T {
5353
const READ_SIZE: usize = T::READ_SIZE;
5454

55-
async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
56-
T::read(self, offset, bytes)
55+
async fn read(
56+
&mut self,
57+
offset: u32,
58+
bytes: &mut [u8],
59+
) -> Result<(), <&mut T as ErrorType>::Error> {
60+
T::read(self, offset, bytes).await
5761
}
5862

5963
fn capacity(&self) -> usize {
@@ -65,11 +69,15 @@ impl<T: NorFlash> NorFlash for &mut T {
6569
const WRITE_SIZE: usize = T::WRITE_SIZE;
6670
const ERASE_SIZE: usize = T::ERASE_SIZE;
6771

68-
async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
69-
T::erase(self, from, to)
72+
async fn erase(&mut self, from: u32, to: u32) -> Result<(), <&mut T as ErrorType>::Error> {
73+
T::erase(self, from, to).await
7074
}
7175

72-
async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
73-
T::write(self, offset, bytes)
76+
async fn write(
77+
&mut self,
78+
offset: u32,
79+
bytes: &[u8],
80+
) -> Result<(), <&mut T as ErrorType>::Error> {
81+
T::write(self, offset, bytes).await
7482
}
7583
}

0 commit comments

Comments
 (0)