Skip to content

Commit 733ae1b

Browse files
committed
uefi: Add iter(_mut) accessors to AlignedBuffer
1 parent ce6b880 commit 733ae1b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

uefi/src/mem/aligned_buffer.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ impl AlignedBuffer {
6969
self.layout.size()
7070
}
7171

72+
/// Returns an iterator over the aligned buffer contents.
73+
pub fn iter(&self) -> impl Iterator<Item = &u8> {
74+
self.as_slice().iter()
75+
}
76+
77+
/// Returns a mutable iterator over the aligned buffer contents.
78+
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut u8> {
79+
self.as_slice_mut().iter_mut()
80+
}
81+
7282
/// Fill the aligned memory region with data from the given buffer.
7383
///
7484
/// The length of `src` must be the same as `self`.

0 commit comments

Comments
 (0)