@@ -1990,8 +1990,11 @@ pub struct MemoryMapSize {
19901990 pub map_size : usize ,
19911991}
19921992
1993- /// An iterator of [`MemoryDescriptor`] which returns elements in sorted order. The underlying memory map is always
1994- /// associated with the unique [`MemoryMapKey`] contained in the struct.
1993+ /// An iterator of [`MemoryDescriptor`] that is always associated with the
1994+ /// unique [`MemoryMapKey`] contained in the struct.
1995+ ///
1996+ /// To iterate over the entries, call [`MemoryMap::entries`]. To get a sorted
1997+ /// map, you manually have to call [`MemoryMap::sort`] first.
19951998pub struct MemoryMap < ' buf > {
19961999 key : MemoryMapKey ,
19972000 buf : & ' buf mut [ u8 ] ,
@@ -2007,6 +2010,7 @@ impl<'buf> MemoryMap<'buf> {
20072010 }
20082011
20092012 /// Sorts the memory map by physical address in place.
2013+ /// This operation is optional and should be invoked only once.
20102014 pub fn sort ( & mut self ) {
20112015 unsafe {
20122016 self . qsort ( 0 , self . len - 1 ) ;
@@ -2075,8 +2079,9 @@ impl<'buf> MemoryMap<'buf> {
20752079 elem. phys_start
20762080 }
20772081
2082+ /// Returns an iterator over the contained memory map. To get a sorted map,
2083+ /// call [`MemoryMap::sort`] first.
20782084 #[ must_use]
2079- /// Returns an iterator over the contained memory map
20802085 pub fn entries ( & self ) -> MemoryMapIter {
20812086 MemoryMapIter {
20822087 buffer : self . buf ,
@@ -2356,7 +2361,6 @@ mod tests {
23562361 }
23572362
23582363 // Added for debug purposes on test failure
2359- #[ cfg( test) ]
23602364 impl core:: fmt:: Display for MemoryMap < ' _ > {
23612365 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
23622366 writeln ! ( f) ?;
0 commit comments