@@ -113,12 +113,6 @@ impl<S: PageSize> Page<S> {
113
113
self . start_address ( ) . p3_index ( )
114
114
}
115
115
116
- /// Returns a range of pages, inclusive `end`.
117
- #[ inline]
118
- pub fn range_inclusive ( start : Self , end : Self ) -> PageRangeInclusive < S > {
119
- PageRangeInclusive { start, end }
120
- }
121
-
122
116
/// Returns a range of pages, exclusive `end`.
123
117
#[ inline]
124
118
pub const fn range ( start : Self , end : Self ) -> PageRange < S > {
@@ -224,40 +218,6 @@ impl<S: PageSize> fmt::Debug for PageRange<S> {
224
218
}
225
219
}
226
220
227
- /// A range of pages with inclusive upper bound.
228
- #[ derive( Clone , Copy , PartialEq , Eq ) ]
229
- #[ repr( C ) ]
230
- pub struct PageRangeInclusive < S : PageSize = Size4KiB > {
231
- /// The start of the range, inclusive.
232
- pub start : Page < S > ,
233
- /// The end of the range, inclusive.
234
- pub end : Page < S > ,
235
- }
236
-
237
- impl < S : PageSize > Iterator for PageRangeInclusive < S > {
238
- type Item = Page < S > ;
239
-
240
- #[ inline]
241
- fn next ( & mut self ) -> Option < Self :: Item > {
242
- if self . start <= self . end {
243
- let page = self . start ;
244
- self . start += 1 ;
245
- Some ( page)
246
- } else {
247
- None
248
- }
249
- }
250
- }
251
-
252
- impl < S : PageSize > fmt:: Debug for PageRangeInclusive < S > {
253
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
254
- f. debug_struct ( "PageRangeInclusive" )
255
- . field ( "start" , & self . start )
256
- . field ( "end" , & self . end )
257
- . finish ( )
258
- }
259
- }
260
-
261
221
/// The given address was not sufficiently aligned.
262
222
#[ derive( Debug ) ]
263
223
pub struct AddressNotAligned ;
@@ -432,27 +392,3 @@ impl<S: PageSize> fmt::Debug for PhysFrameRangeInclusive<S> {
432
392
. finish ( )
433
393
}
434
394
}
435
-
436
- #[ cfg( test) ]
437
- mod tests {
438
- use super :: * ;
439
-
440
- #[ test]
441
- pub fn test_page_ranges ( ) {
442
- let page_size = Size4KiB :: SIZE ;
443
- let number = 1000 ;
444
-
445
- let start_addr = VirtAddr :: new ( 0xdead_beaf ) ;
446
- let start: Page = Page :: containing_address ( start_addr) ;
447
- let end = start + number;
448
-
449
- let mut range_inclusive = Page :: range_inclusive ( start, end) ;
450
- for i in 0 ..=number {
451
- assert_eq ! (
452
- range_inclusive. next( ) ,
453
- Some ( Page :: containing_address( start_addr + page_size * i) )
454
- ) ;
455
- }
456
- assert_eq ! ( range_inclusive. next( ) , None ) ;
457
- }
458
- }
0 commit comments