File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,14 @@ pub trait NorFlashRegion {
104104 fn erase_sizes ( & self ) -> Vec < usize , U5 > ;
105105}
106106
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+
107115/// NOR flash storage trait
108116pub trait NorFlash {
109117 /// An enumeration of storage errors
@@ -141,11 +149,8 @@ pub trait NorFlash {
141149/// address range
142150pub trait UniformNorFlash { }
143151
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 {
149154 /// The range of possible addresses within the peripheral.
150155 ///
151156 /// (start_addr, end_addr)
You can’t perform that action at this time.
0 commit comments