File tree 1 file changed +10
-5
lines changed 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,14 @@ pub trait NorFlashRegion {
104
104
fn erase_sizes ( & self ) -> Vec < usize , U5 > ;
105
105
}
106
106
107
+ /// Blanket implementation for all types implementing [`NorFlashRegion`]
108
+ impl < T : NorFlashRegion > Region for T {
109
+ fn contains ( & self , address : Address ) -> bool {
110
+ let ( start, end) = self . range ( ) ;
111
+ address. 0 >= start. 0 && address. 0 < end. 0
112
+ }
113
+ }
114
+
107
115
/// NOR flash storage trait
108
116
pub trait NorFlash {
109
117
/// An enumeration of storage errors
@@ -141,11 +149,8 @@ pub trait NorFlash {
141
149
/// address range
142
150
pub trait UniformNorFlash { }
143
151
144
- /// Automatic implementation of region trait for uniform NOR flashes
145
- impl < T > NorFlashRegion for T
146
- where
147
- T : NorFlash + UniformNorFlash ,
148
- {
152
+ /// Blanket implementation for all types implementing [`NorFlash`] and [`UniformNorFlash`]
153
+ impl < T : NorFlash + UniformNorFlash > NorFlashRegion for T {
149
154
/// The range of possible addresses within the peripheral.
150
155
///
151
156
/// (start_addr, end_addr)
You can’t perform that action at this time.
0 commit comments