Skip to content

Commit 20ba9c2

Browse files
committed
adding is-empty check function
1 parent 922c557 commit 20ba9c2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/structures/paging/page_table.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ impl PageTable {
216216
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut PageTableEntry> {
217217
self.entries.iter_mut()
218218
}
219+
220+
/// Checks if the page table is empty (all entries are zero).
221+
#[inline]
222+
pub fn is_empty(&self) -> bool {
223+
self.entries.iter().all(|entry| entry.is_unused())
224+
}
219225
}
220226

221227
impl Index<usize> for PageTable {

0 commit comments

Comments
 (0)