File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
embedded-storage-async/src Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
use core:: future:: Future ;
2
- use embedded_storage:: nor_flash:: NorFlashError ;
2
+ use embedded_storage:: nor_flash:: ErrorType ;
3
3
4
4
/// Read only NOR flash trait.
5
- pub trait AsyncReadNorFlash {
6
- /// Errors returned by this NOR flash.
7
- type Error : NorFlashError ;
8
-
5
+ pub trait AsyncReadNorFlash : ErrorType {
9
6
/// The minumum number of bytes the storage peripheral can read
10
7
const READ_SIZE : usize ;
11
8
Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ impl NorFlashError for core::convert::Infallible {
15
15
}
16
16
}
17
17
18
+ /// A trait that NorFlash implementations can use to share an error type.
19
+ pub trait ErrorType {
20
+ /// Errors returned by this NOR flash.
21
+ type Error : NorFlashError ;
22
+ }
23
+
18
24
/// NOR flash error kinds.
19
25
///
20
26
/// NOR flash implementations must map their error to those generic error kinds through the
@@ -49,10 +55,7 @@ impl core::fmt::Display for NorFlashErrorKind {
49
55
}
50
56
51
57
/// Read only NOR flash trait.
52
- pub trait ReadNorFlash {
53
- /// Errors returned by this NOR flash.
54
- type Error : NorFlashError ;
55
-
58
+ pub trait ReadNorFlash : ErrorType {
56
59
/// The minumum number of bytes the storage peripheral can read
57
60
const READ_SIZE : usize ;
58
61
You can’t perform that action at this time.
0 commit comments