@@ -422,42 +422,6 @@ impl<M: GuestMemory> GuestAddressSpace for Arc<M> {
422
422
}
423
423
}
424
424
425
- /// Lifetime generic associated iterators. The actual iterator type is defined through associated
426
- /// item `Iter`, for example:
427
- ///
428
- /// ```
429
- /// # use std::marker::PhantomData;
430
- /// # use vm_memory::guest_memory::GuestMemoryIterator;
431
- /// #
432
- /// // Declare the relevant Region and Memory types
433
- /// struct MyGuestRegion {/* fields omitted */}
434
- /// struct MyGuestMemory {/* fields omitted */}
435
- ///
436
- /// // Make an Iterator type to iterate over the Regions
437
- /// # /*
438
- /// struct MyGuestMemoryIter<'a> {/* fields omitted */}
439
- /// # */
440
- /// # struct MyGuestMemoryIter<'a> {
441
- /// # _marker: PhantomData<&'a MyGuestRegion>,
442
- /// # }
443
- /// impl<'a> Iterator for MyGuestMemoryIter<'a> {
444
- /// type Item = &'a MyGuestRegion;
445
- /// fn next(&mut self) -> Option<&'a MyGuestRegion> {
446
- /// // ...
447
- /// # None
448
- /// }
449
- /// }
450
- ///
451
- /// // Associate the Iter type with the Memory type
452
- /// impl<'a> GuestMemoryIterator<'a, MyGuestRegion> for MyGuestMemory {
453
- /// type Iter = MyGuestMemoryIter<'a>;
454
- /// }
455
- /// ```
456
- pub trait GuestMemoryIterator < ' a , R : ' a > {
457
- /// Type of the `iter` method's return value.
458
- type Iter : Iterator < Item = & ' a R > ;
459
- }
460
-
461
425
/// `GuestMemory` represents a container for an *immutable* collection of
462
426
/// `GuestMemoryRegion` objects. `GuestMemory` provides the `Bytes<GuestAddress>`
463
427
/// trait to hide the details of accessing guest memory by physical address.
@@ -471,9 +435,6 @@ pub trait GuestMemory {
471
435
/// Type of objects hosted by the address space.
472
436
type R : GuestMemoryRegion ;
473
437
474
- /// Lifetime generic associated iterators. Usually this is just `Self`.
475
- type I : for < ' a > GuestMemoryIterator < ' a , Self :: R > ;
476
-
477
438
/// Returns the number of regions in the collection.
478
439
fn num_regions ( & self ) -> usize ;
479
440
@@ -533,7 +494,7 @@ pub trait GuestMemory {
533
494
/// assert_eq!(3, total_size)
534
495
/// # }
535
496
/// ```
536
- fn iter ( & self ) -> < Self :: I as GuestMemoryIterator < Self :: R > > :: Iter ;
497
+ fn iter ( & self ) -> impl Iterator < Item = & Self :: R > ;
537
498
538
499
/// Applies two functions, specified as callbacks, on the inner memory regions.
539
500
///
0 commit comments